/* ==========================================================================
   AL-AHED GROUP — trade portal, storefront, basket & order styles
   ========================================================================== */

/* ---------- Gate --------------------------------------------------------- */
.gate {
  position: relative;
  min-height: calc(100vh - var(--header-h) - 40px);
  display: grid;
  place-items: center;
  padding-block: clamp(3rem, 8vw, 6rem);
  background: var(--navy-950);
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}
.gate__media { position: absolute; inset: 0; z-index: -1; }
.gate__media img { width: 100%; height: 100%; object-fit: cover; opacity: .28; }
.gate__media::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 0%, rgba(22, 38, 90, .85), var(--navy-950) 70%);
}
.gate__panel {
  width: min(620px, 100%);
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(201, 162, 39, .3);
  border-radius: var(--r-lg);
  padding: clamp(1.75rem, 4vw, 3rem);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-4);
}
.gate__mark { width: 78px; margin-bottom: var(--sp-3); }
.gate__mark { filter: brightness(1.35) saturate(1.05); opacity: .98; }
.gate h1 { color: #fff; font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
.gate p { color: #b7c0d6; }
.gate__code {
  display: flex;
  gap: .6rem;
  margin-top: var(--sp-4);
  flex-wrap: wrap;
}
.gate__code input {
  flex: 1 1 240px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .24);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  letter-spacing: .18em;
  text-align: center;
  text-transform: uppercase;
  padding: 1rem;
  min-height: 58px;
}
.gate__code input::placeholder { color: #6d7893; letter-spacing: .12em; }
.gate__code input:focus { border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(201, 162, 39, .18); }
.gate__err {
  margin-top: var(--sp-2);
  padding: .75rem 1rem;
  background: rgba(196, 18, 47, .16);
  border: 1px solid rgba(196, 18, 47, .5);
  color: #ffc6cf;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
}
.gate__help { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid rgba(255, 255, 255, .12); font-size: var(--fs-sm); }

/* ---------- Portal shell ------------------------------------------------- */
.portal-bar {
  background: var(--navy-900);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.portal-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: .85rem;
  flex-wrap: wrap;
}
.portal-bar__who { font-size: var(--fs-sm); display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.portal-bar__who strong { color: #fff; }
.portal-bar__dot { color: var(--gold-500); }

/* ---------- Store layout ------------------------------------------------- */
.store { background: var(--ivory); padding-block: var(--sp-5) var(--sp-10); }
.store__layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
@media (max-width: 1080px) { .store__layout { grid-template-columns: minmax(0, 1fr); } }

.store__side { position: sticky; top: calc(var(--header-h) + 78px); }
@media (max-width: 1080px) { .store__side { position: static; } }

.filter-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.filter-panel__head {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--slate-700);
  background: var(--ivory);
}
[dir='rtl'] .filter-panel__head { letter-spacing: 0; }
.filter-list { list-style: none; margin: 0; padding: .35rem; max-height: 340px; overflow-y: auto; }
.filter-list li { margin: 0; }
.filter-list button {
  width: 100%;
  text-align: start;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  padding: .55rem .7rem;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--slate-700);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: center;
}
.filter-list button:hover { background: var(--ivory); color: var(--navy-900); }
.filter-list button[aria-pressed='true'] { background: var(--navy-800); color: #fff; font-weight: 700; }
.filter-list button[aria-pressed='true'] .count { color: var(--gold-400); }
.filter-list .count { font-size: var(--fs-xs); color: var(--slate-400); font-variant-numeric: tabular-nums; }

.store__toolbar {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-2);
  margin-bottom: var(--sp-3);
  position: sticky;
  top: calc(var(--header-h) + 8px);
  z-index: 30;
}
.store__search { flex: 1 1 320px; min-width: 0; position: relative; }
.store__search input { padding-inline-start: 2.4rem; width: 100%; }
.store__toolbar select { flex: 0 0 auto; width: auto; max-width: 260px; min-width: 176px; }
.store__search svg { position: absolute; inset-inline-start: .85rem; top: 50%; transform: translateY(-50%); color: var(--slate-400); pointer-events: none; }
.store__count { font-size: var(--fs-xs); color: var(--slate-500); white-space: nowrap; }

/* ---------- Offer strip -------------------------------------------------- */
.offerstrip { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-3); }
@media (min-width: 900px) { .offerstrip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.offerstrip__item {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
  background: linear-gradient(90deg, var(--gold-100), #fff 70%);
  border: 1px solid var(--gold-200);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-3);
}
[dir='rtl'] .offerstrip__item { background: linear-gradient(270deg, var(--gold-100), #fff 70%); }
.offerstrip__tag {
  flex: none;
  background: var(--red-600);
  color: #fff;
  font-size: var(--fs-micro);
  font-weight: 700;
  padding: .25rem .5rem;
  border-radius: var(--r-xs);
  margin-top: .15rem;
}
.offerstrip__title { font-weight: 700; color: var(--navy-900); font-size: var(--fs-sm); }
.offerstrip__body { font-size: var(--fs-xs); color: var(--slate-700); }

/* ---------- Product grid ------------------------------------------------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: var(--sp-2); }
@media (max-width: 640px) { .pgrid { grid-template-columns: minmax(0, 1fr); } }

.pcard {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
  overflow: hidden;
}
.pcard:hover { border-color: var(--navy-300); box-shadow: var(--shadow-3); transform: translateY(-2px); }
.pcard--soon { opacity: .72; }
.pcard__top { padding: var(--sp-3) var(--sp-3) var(--sp-2); display: flex; justify-content: space-between; gap: .6rem; align-items: flex-start; }
.pcard__brand {
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold-600);
}
[dir='rtl'] .pcard__brand { letter-spacing: 0; }
.pcard__name { font-family: var(--font-display); font-size: 1.08rem; font-weight: 600; color: var(--navy-900); margin: .35rem 0 0; line-height: 1.28; }
.pcard__pack { font-size: var(--fs-xs); color: var(--slate-500); margin-top: .4rem; }
.pcard__mid { padding: 0 var(--sp-3); display: flex; flex-wrap: wrap; gap: .35rem; }
.pcard__prices {
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
  margin-top: auto;
  display: grid;
  gap: .5rem;
  border-top: 1px solid var(--line);
}
.price-row { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.price-row__label { font-size: var(--fs-xs); color: var(--slate-500); }
.price-row__value { font-family: var(--font-display); font-size: 1.12rem; font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.price-row__value small { font-size: .68em; color: var(--slate-500); font-family: var(--font-sans); font-weight: 600; }
.price-was { font-size: var(--fs-xs); color: var(--slate-400); text-decoration: line-through; margin-inline-start: .4rem; }
.price-off { color: var(--red-600); }

.pcard__actions { padding: 0 var(--sp-3) var(--sp-3); display: flex; gap: .5rem; align-items: center; }
.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: #fff;
}
.qty button {
  width: 36px; height: 40px;
  background: #fff; border: 0; cursor: pointer; color: var(--navy-800);
  font-size: 1.1rem; line-height: 1;
}
.qty button:hover { background: var(--ivory); }
.qty input {
  width: 54px; height: 40px; border: 0; border-inline: 1px solid var(--line);
  text-align: center; font-size: var(--fs-sm); font-weight: 600;
  border-radius: 0; padding: 0;
}
.qty input:focus { box-shadow: none; }
.mode-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.mode-toggle button {
  padding: .55rem .7rem; background: #fff; border: 0; cursor: pointer;
  font-size: var(--fs-micro); font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--slate-500);
}
.mode-toggle button[aria-pressed='true'] { background: var(--navy-800); color: #fff; }
[dir='rtl'] .mode-toggle button { letter-spacing: 0; }

/* ---------- Basket drawer ------------------------------------------------ */
.basket-fab {
  position: fixed;
  inset-inline-end: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 140;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .95rem 1.25rem;
  background: var(--navy-900);
  color: #fff;
  border: 1px solid var(--gold-500);
  border-radius: 999px;
  box-shadow: var(--shadow-4);
  font-weight: 700;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: transform var(--dur-2) var(--ease);
}
.basket-fab:hover { transform: translateY(-2px); color: #fff; }
.basket-fab__count {
  background: var(--gold-500); color: var(--navy-950);
  min-width: 24px; height: 24px; border-radius: 999px;
  display: grid; place-items: center; font-size: .72rem; padding-inline: .35rem;
}

.drawer-scrim {
  position: fixed; inset: 0; background: rgba(7, 14, 34, .55);
  backdrop-filter: blur(2px); z-index: 150; opacity: 0; pointer-events: none;
  transition: opacity var(--dur-2) var(--ease);
}
.drawer-scrim.is-open { opacity: 1; pointer-events: auto; }
.drawer-scrim[hidden] { display: none; }

.basket {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  width: min(480px, 100%);
  background: #fff;
  z-index: 160;
  display: flex;
  flex-direction: column;
  transform: translateX(102%);
  transition: transform var(--dur-3) var(--ease-out);
  box-shadow: var(--shadow-4);
  visibility: hidden;
}
/* The [hidden] attribute must win over display:flex, otherwise a closed drawer
   still occupies space and creates horizontal overflow in RTL documents. */
.basket[hidden] { display: none; }
[dir='rtl'] .basket { transform: translateX(-102%); }
.basket.is-open { transform: none !important; visibility: visible; }
.basket__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3); border-bottom: 1px solid var(--line); background: var(--ivory);
}
.basket__head h3 { font-size: 1.15rem; }
.basket__close { background: transparent; border: 1px solid var(--line); width: 38px; height: 38px; border-radius: var(--r-sm); cursor: pointer; }
.basket__body { flex: 1; overflow-y: auto; padding: var(--sp-3); }
.basket__foot { border-top: 1px solid var(--line); padding: var(--sp-3); background: var(--ivory); }
.basket__empty { text-align: center; color: var(--slate-500); padding: var(--sp-6) var(--sp-2); font-size: var(--fs-sm); }

.bitem { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; padding-block: var(--sp-2); border-bottom: 1px solid var(--line); }
.bitem:first-child { padding-top: 0; }
.bitem__name { font-weight: 700; font-size: var(--fs-sm); color: var(--navy-900); }
.bitem__meta { font-size: var(--fs-xs); color: var(--slate-500); margin-top: .2rem; }
.bitem__right { text-align: end; }
.bitem__total { font-family: var(--font-display); font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.bitem__remove { background: none; border: 0; color: var(--slate-400); font-size: var(--fs-xs); cursor: pointer; padding: 0; margin-top: .3rem; }
.bitem__remove:hover { color: var(--red-600); text-decoration: underline; }

.sumrow { display: flex; justify-content: space-between; gap: 1rem; font-size: var(--fs-sm); padding-block: .3rem; }
.sumrow--total { border-top: 1px solid var(--line); margin-top: .6rem; padding-top: .75rem; font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--navy-900); }
.sumrow--total span:last-child { color: var(--red-600); }

/* ---------- Checkout ----------------------------------------------------- */
.checkout {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: clamp(1.25rem, 3vw, 2.25rem);
}
.checkout h3 { margin-bottom: var(--sp-1); }
.checkout__grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--sp-4); align-items: start; }
@media (max-width: 980px) { .checkout__grid { grid-template-columns: minmax(0, 1fr); } }
.checkout__summary { background: var(--ivory); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3); position: sticky; top: calc(var(--header-h) + 20px); }
@media (max-width: 980px) { .checkout__summary { position: static; } }

.alert {
  padding: .9rem 1.1rem;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  border: 1px solid var(--line);
  background: var(--ivory);
}
.alert--error { background: #fdeef1; border-color: #f0c2cb; color: #8e0c24; }
.alert--ok { background: #e9f6ef; border-color: #bfe3cd; color: #0f5c35; }
.alert--warn { background: #fdf5e6; border-color: #f0dcb0; color: #8a5b0b; }

/* ---------- Order confirmation ------------------------------------------ */
.receipt { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.receipt__head { background: var(--navy-900); color: #fff; padding: var(--sp-4) var(--sp-4); }
.receipt__head h1 { color: #fff; font-size: clamp(1.5rem, 3.4vw, 2.1rem); }
.receipt__no { font-family: var(--font-mono); font-size: 1.1rem; color: var(--gold-400); letter-spacing: .08em; }
.receipt__body { padding: var(--sp-4); }
.receipt__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
@media (max-width: 720px) { .receipt__grid { grid-template-columns: minmax(0, 1fr); } }
.datalist { list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); }
.datalist li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px dotted var(--line); margin: 0; }
.datalist li span:first-child { color: var(--slate-500); }
.datalist li span:last-child { font-weight: 600; color: var(--navy-900); text-align: end; }

/* ---------- Toast ------------------------------------------------------- */
.toast-host {
  position: fixed;
  inset-block-end: 1.25rem;
  inset-inline-start: 1.25rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  background: var(--navy-900);
  color: #fff;
  border-inline-start: 3px solid var(--gold-500);
  border-radius: var(--r-sm);
  padding: .8rem 1.1rem;
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-4);
  animation: toast-in 260ms var(--ease-out);
  max-width: 340px;
}
.toast--err { border-inline-start-color: var(--red-500); }
.toast--ok { border-inline-start-color: #2fbf71; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Print ------------------------------------------------------- */
@media print {
  .site-header, .util, .site-footer, .basket-fab, .portal-bar, .no-print { display: none !important; }
  body { background: #fff; }
  .receipt, .checkout { border: 0; box-shadow: none; }
}
