/* Storefront layout — مذخر الأبدال */
.skip-link { position: absolute; top: -60px; inset-inline-start: 1rem; background: var(--navy-900); color: #fff; padding: .6rem 1rem; border-radius: 0 0 10px 10px; z-index: 100; }
.skip-link:focus { top: 0; }

/* Header */
.site-header { position: sticky; top: 0; z-index: var(--z-sticky); background: rgba(255,255,255,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.header-inner { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; min-height: 72px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
/* Visitors see the emblem only; the name appears once a staff account (admin / supervisor / rep) signs in. */
body.is-customer .brand-text, body.is-customer .footer-brand-text { display: none; }
.header-search { max-width: 560px; width: 100%; justify-self: center; }
.header-search .icon-wrap { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: .85rem; color: var(--text-3); pointer-events: none; display: flex; }
.header-search .input { padding-inline-start: 2.6rem; padding-inline-end: 2.6rem; border-radius: 999px; background: var(--surface-2); }
.header-search .input:focus { background: #fff; }
.header-actions { display: flex; align-items: center; gap: .5rem; }
/* The staff gateways carry a full label on wide screens and a short one on phones — never an icon alone,
   or people cannot tell "دخول المندوب" from "دخول المشرف". */
.lbl-short { display: none; }
.staff-bar { display: flex; align-items: center; gap: .35rem; padding: .25rem .35rem .25rem .6rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); max-width: 100%; }
.staff-bar .staff-name { font-weight: 700; font-size: var(--fs-sm); max-width: 160px; }
.hero-link { color: #fff; text-decoration: underline; }
body.is-customer .cart-btn, body.is-customer .mobile-cart-bar { display: none !important; }
.header-phone { color: var(--navy-800); }
.cart-btn { position: relative; border-radius: 999px; padding-inline: 1.1rem; }
.cart-icon { display: inline-flex; }
.cart-badge { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--teal-500); color: #fff; font-size: .75rem; font-weight: 800; display: grid; place-items: center; border: 2px solid #fff; }
.cart-btn.bump { animation: bump .35s var(--ease); }
@keyframes bump { 30% { transform: scale(1.08); } }

/* Hero */
.hero { background: var(--brand-gradient-soft); color: #fff; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(600px 300px at 85% 20%, rgba(61,187,156,.35), transparent 60%), radial-gradient(500px 260px at 10% 90%, rgba(42,83,153,.5), transparent 60%); pointer-events: none; }
.hero-inner { position: relative; display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: center; padding-block: clamp(1.75rem, 4vw, 3rem); }
.hero-kicker { display: inline-block; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; background: rgba(255,255,255,.14); padding: .25rem .75rem; border-radius: 999px; margin-bottom: .75rem; }
.hero h1 { font-size: clamp(1.5rem, 3.2vw, 2.4rem); font-weight: 800; color: #fff; }
.hero-sub { margin-top: .6rem; color: rgba(255,255,255,.86); max-width: 56ch; }
.hero-steps { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; margin-top: 1.1rem; font-size: var(--fs-sm); }
.hero-step { display: inline-flex; align-items: center; gap: .5rem; color: rgba(255,255,255,.92); }
.step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--teal-400); color: var(--navy-950); font-weight: 800; display: grid; place-items: center; font-size: .8rem; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.hero-stat { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius-lg); padding: 1rem 1.25rem; backdrop-filter: blur(6px); }
.hero-stat-value { display: block; font-size: var(--fs-3xl); font-weight: 800; line-height: 1.1; }
.hero-stat-label { color: rgba(255,255,255,.8); font-size: var(--fs-sm); }

.announcement { margin-top: 1rem; }
.announcement .alert { border-radius: var(--radius-lg); }

/* Category chips */
.cat-bar { position: sticky; top: 72px; z-index: calc(var(--z-sticky) - 1); background: var(--bg); padding-block: .75rem; border-bottom: 1px solid var(--border); }
.chips-scroller { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; padding-block: 2px; -webkit-overflow-scrolling: touch; }
.chips-scroller::-webkit-scrollbar { display: none; }
.chip-skel { width: 110px; height: 40px; border-radius: 999px; }

/* Main */
.main { padding-block: 1.25rem 3rem; min-height: 50vh; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar-title { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.toolbar-controls { display: flex; gap: .5rem; flex-wrap: wrap; }
.select-sm { min-height: 40px; padding-block: .3rem; width: auto; font-size: var(--fs-sm); }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 1rem; }
.product-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur); position: relative; }
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.product-card.in-cart { border-color: var(--teal-400); box-shadow: 0 0 0 2px var(--teal-100); }
.product-media { position: relative; aspect-ratio: 1; background: #fff; cursor: pointer; border: 0; padding: 0; width: 100%; display: block; }
.product-media img { width: 100%; height: 100%; object-fit: contain; padding: 10px; transition: transform .35s var(--ease); }
.product-card:hover .product-media img { transform: scale(1.04); }
.product-media .placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--text-3); background: var(--surface-2); }
.product-badges { position: absolute; top: .6rem; inset-inline-start: .6rem; display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; }
.product-body { padding: .85rem .95rem 0; flex: 1; display: flex; flex-direction: column; gap: .2rem; }
.product-name { font-weight: 800; font-size: var(--fs-md); line-height: 1.35; color: var(--navy-900); }
.product-name-en { font-size: var(--fs-xs); color: var(--text-3); direction: ltr; text-align: end; font-weight: 600; }
.product-generic { font-size: var(--fs-sm); color: var(--text-2); }
.product-meta { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .35rem; }
.product-price { font-weight: 800; color: var(--teal-700); margin-top: .35rem; }
.product-price.has-discount { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0; }
.product-card.on-sale { border-color: var(--sale); }
.product-footer { padding: .85rem .95rem .95rem; display: flex; align-items: center; gap: .5rem; }
.product-footer .btn { flex: 1; }
.product-footer .qty { flex: 1; justify-content: space-between; }
.product-footer .qty input { flex: 1; width: 40px; }
.card-skel { height: 340px; border-radius: var(--radius-lg); }

/* Cart drawer */
.cart-items { display: flex; flex-direction: column; gap: .6rem; }
.cart-item { display: grid; grid-template-columns: 60px 1fr auto; gap: .75rem; align-items: center; padding: .6rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.cart-item.unavailable { opacity: .65; border-style: dashed; }
.cart-item .thumb { width: 60px; height: 60px; }
.cart-item-title { font-weight: 700; line-height: 1.3; }
.cart-item-sub { font-size: var(--fs-xs); color: var(--text-2); }
.cart-item-actions { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }
.cart-item .qty button { width: 34px; height: 34px; } .cart-item .qty input { height: 34px; width: 44px; }
.cart-summary { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: .75rem; font-size: var(--fs-sm); color: var(--text-2); }
.cart-saved { flex-basis: 100%; display: flex; align-items: center; gap: .3rem; margin-top: .3rem; color: var(--sale-fg); font-weight: 700; font-size: var(--fs-xs); }
.cart-summary strong { color: var(--text); font-size: var(--fs-md); }
.checkout-form .form-grid { grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .checkout-form .form-grid { grid-template-columns: 1fr; } }
.order-review { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; }
.order-review summary { padding: .7rem .9rem; cursor: pointer; font-weight: 700; background: var(--surface-2); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.order-review summary::-webkit-details-marker { display: none; }
.order-review ul { margin: 0; padding: .5rem .9rem; list-style: none; font-size: var(--fs-sm); }
.order-review li { display: flex; justify-content: space-between; gap: .5rem; padding: .3rem 0; border-bottom: 1px dashed var(--border); }
.order-review li:last-child { border-bottom: 0; }
.success-panel { text-align: center; padding: 1.5rem .5rem; }
.success-panel .success-icon { width: 84px; height: 84px; border-radius: 50%; background: var(--success-bg); color: var(--success); display: grid; place-items: center; margin: 0 auto 1rem; }
.success-panel .success-icon svg { width: 44px; height: 44px; }
.order-number { font-size: var(--fs-3xl); font-weight: 800; color: var(--navy-900); }
.recent-pharmacies { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .75rem; }

/* Mobile bar */
.mobile-cart-bar { position: fixed; bottom: 0; inset-inline: 0; padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom, 0px)); background: rgba(255,255,255,.95); border-top: 1px solid var(--border); z-index: var(--z-sticky); backdrop-filter: blur(10px); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 2rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 1.5rem; }
.footer-brand { display: flex; align-items: center; gap: .75rem; }
.footer-contact { display: flex; gap: 1rem; flex-wrap: wrap; color: var(--text-2); }
.footer-contact a { display: inline-flex; align-items: center; gap: .35rem; color: var(--navy-800); }

/* Product detail modal */
.detail { display: grid; grid-template-columns: 1fr 1.2fr; gap: 1.25rem; }
.detail-media { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; }
.detail-media img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.detail-list { display: grid; grid-template-columns: auto 1fr; gap: .35rem .9rem; font-size: var(--fs-sm); margin-top: .75rem; }
.detail-list dt { color: var(--text-3); font-weight: 600; }
.detail-list dd { margin: 0; }
.detail-actions { margin-top: 1rem; display: flex; gap: .5rem; align-items: center; }

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-stats { max-width: 380px; }
  /* Two labelled gateways + the phone link left the search box no room between 769 and ~830px. */
  .lbl-full { display: none; }
  .lbl-short { display: inline; }
  .header-phone { display: none; }
}
@media (max-width: 380px) {
  .brand-mark .brand-name { font-size: var(--fs-md); }
}
@media (max-width: 768px) {
  .header-inner { grid-template-columns: 1fr auto; grid-template-areas: "brand actions" "search search"; padding-block: .6rem; row-gap: .5rem; }
  .brand-mark { grid-area: brand; } .header-search { grid-area: search; max-width: none; } .header-actions { grid-area: actions; }
  .cart-btn .btn-label { display: none; }
  .header-phone { display: none; }
  .staff-bar .staff-name, .staff-bar .btn-label { display: none; }
  .staff-bar { padding: .2rem .25rem; gap: .15rem; }
  .staff-bar .btn-sm { min-height: 36px; padding-inline: .5rem; }
  .brand-mark .brand-sub { display: none; }
  .brand-mark img, .brand-mark svg { width: 36px; height: 36px; }
  #login-btn, #supervisor-btn { padding-inline: .7rem; gap: .35rem; }
  .cat-bar { top: 118px; }
  .main { padding-bottom: 6rem; }
  .mobile-cart-bar[hidden] { display: none; }
  body.has-cart-bar { --toast-bottom: calc(5.6rem + env(safe-area-inset-bottom, 0px)); }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
  .product-footer { flex-direction: column; align-items: stretch; }
  .detail { grid-template-columns: 1fr; }
  .hero-steps { flex-direction: column; gap: .5rem; }
}
@media (min-width: 769px) { .mobile-cart-bar { display: none !important; } }
