/* ============================================================
   Shop Web — components. Tokens come from design-system.css.
   Mobile first, RTL base.
   ============================================================ */

.page {
  max-width: var(--page-max);
  margin-inline: auto;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--s-6));
}

/* ---------- header ---------- */

.header {
  padding: 12px var(--s-4) 10px;
}

.header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: 10px;
  direction: ltr;
}

.header__name {
  font-family: var(--font-body);
  font-size: 36px;
  line-height: 1.1;
  color: var(--accent);
  font-weight: var(--fw-bold);
}
.header__tagline { direction: rtl; font-size: 11px; color: var(--muted); margin-top: 3px; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  flex: none;
  transition: background var(--t-fast);
}

.icon-btn:active { background: var(--bg); }

/* ---------- search ---------- */

.search {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--surface-2);
  border-radius: var(--r-field);
  padding-inline: var(--s-3);
  height: 46px;
}

.search__icon { flex: none; color: var(--muted); }

.search__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: none;
  font-size: var(--fs-md);
}

.search__input::placeholder { color: var(--muted); }

.search__clear { display: grid; place-items: center; width: 44px; height: 44px; color: var(--muted); font-size: var(--fs-sm); flex: none; }

/* ---------- category chips ---------- */

.chips {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 var(--s-4) var(--s-4);
  scroll-padding-inline: var(--s-4);
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  padding: 9px var(--s-4);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-base);
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}

.chip[aria-current="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Only the customer feed has the icon rail; shop filters remain pills. */
.chips--categories { gap: 8px; padding-bottom: 12px; align-items: flex-start; }
.chips--categories .chip { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 2px; background: transparent; font-size: 11px; line-height: 1.5; }
.chip__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); }
.chips--categories .chip[aria-current="true"] { color: var(--accent); font-weight: var(--fw-bold); }
.chips--categories .chip[aria-current="true"] .chip__icon { background: var(--accent); color: var(--accent-ink); }
.chips--categories .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- product grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-inline: 12px;
}

.card {
  container-type: inline-size;
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: 12px;
  min-width: 0;
  overflow: hidden;
  padding-bottom: 2px;
}

/* Square cover frame also crops legacy portrait variants without distortion. */
.card__media {
  position: relative;
  aspect-ratio: 1;
  background: var(--surface-2);
  border-radius: 11px 11px 0 0;
  overflow: hidden;
  margin: 0 0 4px;
}

.card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--t-slide);
}

.card__img.is-active { opacity: 1; }

/* one image: no transition cost at all */
.card__media:not([data-multi]) .card__img { opacity: 1; transition: none; }

.card__heart {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 10px;
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--text);
}

.card__heart[aria-pressed="true"] { color: var(--accent); }

.dots {
  position: absolute;
  inset-block-end: 8px;
  inset-inline: 0;
  display: flex;
  justify-content: center;
  gap: 5px;
  pointer-events: none;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--veil);
  opacity: 0.55;
  transition: opacity var(--t-fast);
}

.dot.is-active { opacity: 1; }

.card__body { padding-inline: 8px; direction: rtl; text-align: right; }

/* Keep text rows predictable; small circles retain separate 44px targets. */
.card__commercial { direction: rtl; }
.card__commercial .card__price { flex-wrap: wrap; min-width: 0; max-width: 100%; margin: 0; white-space: nowrap; line-height: 1.4; }
/* Keep the full amount and currency readable, even with enlarged fallback text. */
.card__commercial .card__amount { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.card__commercial .card__currency { flex-shrink: 0; }
@container (max-width: 145px) {
  .card__commercial .card__price { gap: 3px; }
  .card__commercial .card__amount { font-size: 17px; }
}
.card__actions { display: flex; flex: 0 0 auto; direction: ltr; }
.card .card__actions { margin-inline: -6px; min-height: 44px; }
.card__actions:empty { display: none; }
.card__action { position: relative; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; padding: 0; border-radius: 10px; }
.card__action > span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; }
.card__action--share { color: #2465A0; }
.card__action--share > span { background: #EFF5FC; }
.card__action--whatsapp { color: var(--accent); }
.card__action--whatsapp > span { background: #EDF6F0; }
.card__action--location { color: #BD3546; }
.card__action--location > span { background: #FCF0F2; }
.card .card__action--share, .card .card__action--location { color: var(--accent); }
.card .card__action--share > span, .card .card__action--location > span { background: var(--bg); }
.card .card__action--whatsapp { color: var(--accent-ink); }
.card .card__action--whatsapp > span { background: var(--accent); }
.card__action:focus-visible { outline: 2px solid currentColor; outline-offset: -3px; }
.card__action:active > span { opacity: .7; }
.card-share-status { position: fixed; z-index: 50; inset-inline: 16px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); max-width: 440px; margin: 0 auto; padding: 10px 14px; border-radius: 12px; background: var(--text); color: var(--surface); font-size: 13px; text-align: center; pointer-events: none; }
.card__heart[data-fav] { inset-block-start: 4px; inset-inline-end: 4px; width: 44px; height: 44px; background: transparent; }
.card__heart[data-fav]::before { content: ''; position: absolute; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); }
.card__heart[data-fav] svg { position: relative; }

.card__title {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: var(--fw-bold);
  line-height: 1.65;
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: right;
}

/* The price group reads left-to-right — "35,000 IQD" — even though the
   card is RTL, then sits flush against the card's start (right) edge. */
.card__price {
  margin-top: 3px;
  margin-bottom: 0;
  color: var(--accent);
  display: flex;
  direction: ltr;
  justify-content: flex-end;
  align-items: baseline;
  gap: 5px;
}

.card__amount {
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: var(--fw-bold);
}

.card__currency {
  font-size: 12px;
  color: inherit;
}

.card__shop {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.shop-avatar {
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  flex: none;
  object-fit: cover;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: var(--fw-bold);
  color: var(--muted);
  text-transform: uppercase;
}

.card__shop-name {
  font-size: var(--fs-sm);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__shop .shop-avatar { width: 16px; height: 16px; font-size: 9px; }
.card__shop-name { font-size: 11px; line-height: 18px; }

/* ---------- load more ---------- */

.load-more-wrap {
  padding: var(--s-5) var(--s-4) 0;
  display: flex;
  justify-content: center;
}

.load-more {
  width: 100%;
  padding: 14px;
  border-radius: var(--r-field);
  background: var(--surface-2);
  color: var(--accent);
  font-family: var(--font-head);
  font-weight: var(--fw-bold);
  font-size: var(--fs-base);
  text-align: center;
}

.load-more[disabled] { color: var(--muted); }

/* ---------- empty state ---------- */

.empty {
  padding: var(--s-8) var(--s-6);
  text-align: center;
  color: var(--muted);
}

.empty__title {
  font-family: var(--font-head);
  font-weight: var(--fw-bold);
  color: var(--text);
  margin-bottom: var(--s-2);
}

/* ---------- bottom nav ---------- */

.nav {
  position: fixed;
  inset-block-end: 0;
  inset-inline: 0;
  z-index: 20;
  background: var(--surface);
  padding-block-end: env(safe-area-inset-bottom);
}

.nav__inner {
  max-width: var(--page-max);
  margin-inline: auto;
  height: var(--nav-h);
  display: grid;
  /* Three tabs since /saved joined: feed, saved, account. */
  grid-template-columns: repeat(3, 1fr);
}

.nav__tab {
  display: grid;
  place-items: center;
  gap: 3px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.nav__tab[aria-current="page"] { color: var(--accent); }

/* ---------- language sheet ---------- */

.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--scrim);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-slide), visibility var(--t-slide);
}

.sheet {
  position: fixed;
  inset-block-end: 0;
  inset-inline: 0;
  z-index: 31;
  max-width: var(--page-max);
  margin-inline: auto;
  background: var(--surface);
  border-start-start-radius: var(--r-sheet);
  border-start-end-radius: var(--r-sheet);
  padding: var(--s-5) var(--s-4) calc(var(--s-5) + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform var(--t-slide);
}

.sheet[data-open="true"] { transform: translateY(0); }
.sheet-scrim[data-open="true"] { opacity: 1; visibility: visible; }

.sheet__title {
  font-family: var(--font-head);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  margin-bottom: var(--s-4);
}

.lang {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 14px var(--s-3);
  border-radius: var(--r-field);
  text-align: start;
  font-size: var(--fs-md);
}

.lang + .lang { margin-top: var(--s-2); }
.lang[aria-current="true"] { background: var(--surface-2); color: var(--accent); font-weight: var(--fw-bold); }
.lang[disabled] { color: var(--muted); }
.lang__soon { font-size: var(--fs-xs); color: var(--muted); }

/* ---------- motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* The whole card is tappable; the heart sits above the stretched link. */
.card { position: relative; }

.card__hit {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card__heart { z-index: 2; }
.card__media, .card__body { position: relative; }

/* Shared favourite feedback; owner trash buttons have no data-fav attribute. */
button[data-fav] { min-width: 44px; min-height: 44px; }
button[data-fav] svg { width: 18px; height: 18px; fill: none; }
button[data-fav][aria-pressed="true"] { color: #D62F45; }
button[data-fav][aria-pressed="true"] svg { fill: currentColor; }
.fav-status { position: fixed; z-index: 50; inset-inline: 16px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); max-width: 440px; margin: 0 auto; padding: 10px 14px; border-radius: 12px; background: var(--text); color: var(--surface); font-size: 13px; text-align: center; }

/* ------------------------------------------------------------------
   the seller prompt on the feed, and the signed-out account tab

   One slim row, in the scroll, on the page background rather than on a
   card — so it reads as a line of text with an action, not as an advert
   sitting on top of the products. Nothing here animates: a shopping
   feed is somebody else's screen, and a thing that moves on it is a
   thing they have to dismiss.
   ------------------------------------------------------------------ */

.seller-prompt {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 0 var(--s-4) var(--s-4);
  padding: 10px var(--s-3);
  border: 1px solid var(--surface-2);
  border-radius: var(--r-field);
  background: var(--surface);
}

.seller-prompt__text {
  flex: 1;
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--muted);
}

.seller-prompt__cta {
  flex: none;
  padding: 8px var(--s-3);
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-head);
  font-size: var(--fs-sm);
  text-decoration: none;
  white-space: nowrap;
}

/* Narrow phones: the line wraps above the button rather than squeezing
   both into a strip too tight to read or to tap. */
@media (max-width: 359px) {
  .seller-prompt { flex-wrap: wrap; }
  .seller-prompt__cta { width: 100%; text-align: center; }
}
