/* ==========================================================
   متجر قصي — تصميم مستوحى من البساطة الرياضية (أبيض/أسود، خطوط عريضة، أزرار دائرية)
   يعتمد على الخصائص المنطقية (inline-start/end) ليعمل تلقائياً مع RTL و LTR
   ========================================================== */
:root {
  --ink: #111111;
  --ink-2: #39393b;
  --muted: #707072;
  --line: #e5e5e5;
  --border: #cacacb;
  --surface: #f5f5f5;
  --bg: #ffffff;
  --sale: #d43f21;
  --ok: #007d48;
  --warn: #b85c00;
  --radius: 20px;
  --pill: 999px;
  --gutter: clamp(16px, 3.5vw, 48px);
  --header-h: 60px;
  --font: 'Inter', 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
html[lang="ar"] { --font: 'Cairo', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  padding-bottom: env(safe-area-inset-bottom);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; font-weight: 600; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.skip-link { position: absolute; inset-inline-start: -9999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 16px; border-radius: var(--pill); z-index: 999; }
.skip-link:focus { inset-inline-start: 8px; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.container { padding-inline: var(--gutter); max-width: 1440px; margin-inline: auto; }
.container.narrow { max-width: 760px; }
.page-title { font-size: clamp(24px, 3vw, 32px); font-weight: 600; margin-block: 24px 16px; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 24px; border-radius: var(--pill); border: 1.5px solid transparent;
  font-weight: 600; font-size: 16px; line-height: 1.2; background: var(--surface); color: var(--ink);
  transition: background .2s, color .2s, border-color .2s, opacity .2s; white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #5a5a5c; }
.btn-light { background: #fff; color: var(--ink); }
.btn-light:hover { background: #e5e5e5; }
.btn-outline { background: transparent; border-color: var(--border); }
.btn-outline:hover { border-color: var(--ink); }
.btn-ghost-light { background: transparent; color: #fff; border-color: #fff; }
.btn-ghost-light:hover { background: rgba(255,255,255,.15); }
.btn-danger { background: transparent; color: var(--sale); border-color: #f1c6bd; }
.btn-danger:hover { background: #fdecea; }
.btn-lg { min-height: 58px; font-size: 16px; padding-inline: 32px; }
.btn-sm { min-height: 38px; padding: 6px 18px; font-size: 15px; }
.btn-xs { min-height: 32px; padding: 4px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn-row.center { justify-content: center; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: transparent; border: 0; color: var(--ink); position: relative; transition: background .2s;
}
.icon-btn:hover { background: var(--surface); }
.round-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--surface); font-size: 26px; line-height: 1; display: grid; place-items: center; }
.round-btn:hover { background: var(--line); }
[dir="rtl"] .round-btn { transform: scaleX(-1); }
.link-underline { text-decoration: underline; text-underline-offset: 4px; font-weight: 500; }
.chip { display: inline-flex; align-items: center; padding: 10px 20px; border: 1.5px solid var(--border); border-radius: var(--pill); font-weight: 500; background: #fff; transition: border-color .2s; }
.chip:hover { border-color: var(--ink); }
.chip-sm { padding: 5px 12px; font-size: 13px; }

/* ---------- الشريط العلوي والهيدر ---------- */
.promo-bar { background: var(--surface); text-align: center; font-size: 13px; font-weight: 500; padding: 8px var(--gutter); }
.site-header { position: sticky; top: 0; z-index: 50; background: #fff; transition: transform .3s ease; }
.site-header.hide { transform: translateY(-100%); }
.header-inner { height: var(--header-h); display: flex; align-items: center; gap: 12px; padding-inline: var(--gutter); max-width: 1920px; margin-inline: auto; }
.logo { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; font-size: 24px; letter-spacing: -.02em; font-style: italic; flex-shrink: 0; }
.logo-mark { color: var(--ink); }
[dir="rtl"] .logo-mark { transform: scaleX(-1); }
.main-nav { flex: 1; display: flex; justify-content: center; gap: 4px; }
.main-nav a { padding: 8px 12px; font-weight: 500; border-bottom: 2px solid transparent; }
.main-nav a:hover, .main-nav a.active { border-bottom-color: var(--ink); }
.nav-sale { color: var(--sale); }
.header-actions { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.search-pill { display: flex; align-items: center; gap: 6px; background: var(--surface); border-radius: var(--pill); padding-inline: 10px 14px; height: 40px; width: 190px; transition: background .2s; }
.search-pill:hover { background: var(--line); }
.search-pill input { border: 0; background: transparent; outline: none; width: 100%; font-size: 15px; }
.lang-btn { display: inline-grid; place-items: center; min-width: 40px; height: 40px; border-radius: 50%; font-weight: 700; font-size: 14px; }
.lang-btn:hover { background: var(--surface); }
.bag-count { position: absolute; top: 8px; inset-inline-start: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 700; margin-top: 5px; }
.menu-toggle { display: none; }

/* ---------- القائمة الجانبية للجوال ---------- */
.drawer { position: fixed; inset: 0; z-index: 100; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.35); animation: fade .2s; }
.drawer-panel { position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: min(88vw, 360px); background: #fff; padding: 20px 24px; overflow-y: auto; animation: slideIn .25s ease; display: flex; flex-direction: column; }
[dir="rtl"] .drawer-panel { animation-name: slideInRtl; }
.drawer-close { align-self: flex-end; }
.drawer-nav { display: flex; flex-direction: column; margin-top: 12px; }
.drawer-nav a { font-size: 24px; font-weight: 500; padding: 8px 0; }
.drawer-footer { margin-top: 32px; display: flex; flex-direction: column; gap: 12px; }
.drawer-link { background: none; border: 0; padding: 8px 0; text-align: start; font-weight: 500; }
@keyframes fade { from { opacity: 0; } }
@keyframes slideIn { from { transform: translateX(100%); } }
@keyframes slideInRtl { from { transform: translateX(-100%); } }

/* ---------- الرسائل ---------- */
.flash { margin: 12px var(--gutter); padding: 12px 16px; border-radius: 12px; font-weight: 500; background: var(--surface); }
.flash-success { background: #e6f4ea; color: var(--ok); }
.flash-error { background: #fdecea; color: var(--sale); }
.flash-info { background: #eef3fd; color: #1f4fb8; }

/* ---------- الواجهة الرئيسية ---------- */
.hero { position: relative; min-height: min(86vh, 820px); display: flex; align-items: flex-end; color: #fff; overflow: hidden; background: #222; }
.hero picture, .hero picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.65), rgba(0,0,0,.05) 60%); }
.hero-copy { position: relative; z-index: 1; padding: 48px var(--gutter); max-width: 900px; }
.eyebrow { font-weight: 600; margin-bottom: 8px; }
.display { font-weight: 900; text-transform: uppercase; line-height: .92; letter-spacing: -.02em; font-size: clamp(48px, 9vw, 112px); }
html[lang="ar"] .display { line-height: 1.15; letter-spacing: 0; font-size: clamp(44px, 8vw, 96px); }
.hero-text { font-size: clamp(16px, 1.6vw, 19px); margin: 16px 0 24px; max-width: 560px; }

.section { padding: 48px var(--gutter) 16px; max-width: 1920px; margin-inline: auto; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head h2 { font-size: clamp(20px, 2.2vw, 24px); font-weight: 600; }
.carousel-ctrl { display: flex; align-items: center; gap: 10px; }
.carousel-ctrl .link-underline { margin-inline-end: 8px; }

.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, calc((100% - 32px) / 3)); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 8px; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tile { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: var(--surface); }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.tile:hover img { transform: scale(1.04); }
.tile-label { position: absolute; bottom: 32px; inset-inline-start: 32px; }

.banner { position: relative; margin-top: 48px; min-height: 560px; display: grid; place-items: center; text-align: center; color: #fff; overflow: hidden; background: #222; }
.banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner::after { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.banner-copy { position: relative; z-index: 1; padding: 32px var(--gutter); display: grid; justify-items: center; gap: 16px; }
.banner-copy p { font-size: 18px; max-width: 520px; }

.cat-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-bottom: 48px; }
.perk { background: var(--surface); padding: 24px; border-radius: var(--radius); display: grid; gap: 4px; }
.perk span { color: var(--muted); font-size: 15px; }

/* ---------- بطاقة المنتج ---------- */
.grid { display: grid; gap: 16px 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.card { display: block; }
.card-media { position: relative; aspect-ratio: 1; background: var(--surface); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-media img { transform: scale(1.03); }
.tag { position: absolute; top: 12px; inset-inline-start: 12px; background: #fff; padding: 4px 10px; border-radius: var(--pill); font-size: 13px; font-weight: 600; }
.tag-sale { color: var(--sale); }
.tag-new { color: var(--warn); }
.card-body { padding-top: 12px; }
.card-title { font-size: 16px; font-weight: 600; }
.card-sub { color: var(--muted); font-size: 15px; }
.card-price { margin-top: 6px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.card-price s, .pdp-price s { color: var(--muted); font-weight: 400; }

/* ---------- صفحة المتجر والفلاتر ---------- */
.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px var(--gutter); position: sticky; top: 0; background: #fff; z-index: 20; flex-wrap: wrap; }
.site-header:not(.hide) ~ main .shop-head { top: var(--header-h); }
.shop-head h1 { font-size: clamp(20px, 2.4vw, 24px); font-weight: 600; }
.shop-tools { display: flex; align-items: center; gap: 12px; }
.sort-form select { border: 0; background: transparent; font-weight: 600; padding: 6px; }
.filter-toggle { display: none; }
.shop-layout { display: grid; grid-template-columns: 260px 1fr; gap: 32px; padding: 0 var(--gutter) 48px; max-width: 1920px; margin-inline: auto; }
.filters-panel { position: sticky; top: calc(var(--header-h) + 80px); max-height: calc(100vh - var(--header-h) - 100px); overflow-y: auto; padding-inline-end: 8px; scrollbar-width: thin; }
.filters-top, .filters-backdrop { display: none; }
.f-group { border-bottom: 1px solid var(--line); padding: 12px 0; }
.f-group summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; padding: 4px 0 8px; }
.f-group summary::after { content: '⌄'; font-size: 18px; line-height: 1; }
.f-group[open] summary::after { transform: rotate(180deg); }
.f-group summary::-webkit-details-marker { display: none; }
.check { display: flex; align-items: center; gap: 10px; padding: 5px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.price-inputs { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.price-inputs input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.quick-prices { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.size-filter { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.size-chip input, .size-btn input, .color-opt input, .pay-opt input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.size-chip span { display: grid; place-items: center; height: 40px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; cursor: pointer; }
.size-chip input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; }
.color-filter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 4px; }
.color-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; position: relative; }
.color-opt small { font-size: 12px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); position: relative; }
.color-opt input:checked + .swatch { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.color-opt input:focus-visible + .swatch { outline: 2px solid var(--ink); outline-offset: 4px; }
.filters-actions { display: flex; gap: 8px; padding: 16px 0; position: sticky; bottom: 0; background: #fff; }
.filters-actions .btn { flex: 1; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 40px; flex-wrap: wrap; }
.pagination a { min-width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; font-weight: 600; }
.pagination a.active { background: var(--ink); color: #fff; }
.empty { text-align: center; padding: 64px 16px; display: grid; gap: 12px; justify-items: center; }

/* ---------- صفحة المنتج ---------- */
.pdp { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 48px; padding: 32px var(--gutter) 24px; max-width: 1440px; margin-inline: auto; }
.pdp-gallery { display: grid; grid-template-columns: 72px 1fr; gap: 16px; align-self: start; position: sticky; top: calc(var(--header-h) + 16px); }
.pdp-thumbs { display: flex; flex-direction: column; gap: 8px; }
.pdp-thumb { padding: 0; border: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 1; background: var(--surface); opacity: .7; }
.pdp-thumb.active, .pdp-thumb:hover { opacity: 1; box-shadow: 0 0 0 2px var(--ink); }
.pdp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pdp-main { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 12px; background: var(--surface); }
.pdp-main::-webkit-scrollbar { display: none; }
.pdp-slide { margin: 0; scroll-snap-align: start; aspect-ratio: 4 / 5; }
.pdp-slide img { width: 100%; height: 100%; object-fit: cover; }
.pdp-dots { display: none; }
.pdp-flag { color: var(--sale); font-weight: 600; }
.pdp-title { font-size: clamp(24px, 2.6vw, 28px); font-weight: 600; }
.pdp-sub { font-weight: 500; margin-top: 4px; }
.pdp-price { margin-top: 16px; font-size: 18px; font-weight: 600; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.pct { color: var(--ok); font-style: normal; font-size: 16px; }
.pdp-form { margin-top: 28px; display: grid; gap: 20px; }
.opt-group { border: 0; padding: 0; margin: 0; min-width: 0; }
.opt-group legend { font-weight: 600; margin-bottom: 10px; padding: 0; width: 100%; }
.opt-legend-row { display: flex !important; justify-content: space-between; }
.color-pick { display: flex; flex-wrap: wrap; gap: 14px; }
.color-opt.big .swatch { width: 40px; height: 40px; }
.size-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.size-btn span { display: grid; place-items: center; height: 48px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; transition: border-color .15s; font-weight: 500; }
.size-btn span:hover { border-color: var(--ink); }
.size-btn input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.size-btn input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
[data-size-group].error .size-btn span { border-color: var(--sale); }
.field-error { color: var(--sale); font-size: 14px; margin-top: 6px; }
.low-stock { color: var(--warn); font-weight: 600; }
.qty-row { display: flex; align-items: center; justify-content: space-between; }
.qty-row select { padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--pill); background: #fff; }
.pdp-desc { margin-top: 32px; line-height: 1.8; }
.pdp-more { border-top: 1px solid var(--line); padding: 20px 0; }
.pdp-more:last-of-type { border-bottom: 1px solid var(--line); }
.pdp-more summary { font-weight: 600; font-size: 18px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.pdp-more summary::after { content: '⌄'; }
.pdp-more[open] summary::after { transform: rotate(180deg); }
.pdp-more summary::-webkit-details-marker { display: none; }
.pdp-more p { margin-top: 12px; color: var(--ink-2); }

.added-toast { position: fixed; top: calc(var(--header-h) + 8px); inset-inline-end: var(--gutter); z-index: 60; width: min(400px, calc(100vw - 32px)); background: #fff; border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,.18); animation: drop .25s ease; }
@keyframes drop { from { opacity: 0; transform: translateY(-12px); } }
.added-inner { padding: 20px; display: grid; gap: 16px; }
.added-title { font-weight: 600; }
.added-product { display: flex; gap: 12px; }
.added-product img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--surface); }
.added-inner .btn-row .btn { flex: 1; }

/* ---------- السلة والدفع ---------- */
.cart-page, .checkout-page { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 48px; padding-bottom: 64px; max-width: 1100px; }
.ship-progress { background: var(--surface); padding: 16px; border-radius: 12px; margin-bottom: 16px; }
.ship-progress p { font-weight: 500; margin-bottom: 10px; }
.bar { height: 6px; background: #ddd; border-radius: 3px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.cart-list { list-style: none; padding: 0; margin: 0; }
.cart-item { display: grid; grid-template-columns: 150px 1fr; gap: 20px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.cart-img { aspect-ratio: 1; background: var(--surface); }
.cart-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-row { display: flex; justify-content: space-between; gap: 12px; }
.cart-name { font-weight: 600; }
.cart-actions { display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.cart-actions select { padding: 4px 8px; border: 0; background: transparent; font-weight: 600; }
.inline-form { display: inline; margin: 0; }
.summary { align-self: start; position: sticky; top: calc(var(--header-h) + 24px); padding-top: 24px; }
.summary h2 { font-size: 24px; margin-bottom: 20px; }
.totals { margin: 0 0 24px; display: grid; gap: 10px; }
.totals > div { display: flex; justify-content: space-between; }
.totals dt, .totals dd { margin: 0; }
.total-row { border-block: 1px solid var(--line); padding: 14px 0; font-weight: 600; }
.vat-row { color: var(--muted); font-size: 14px; }
.mini-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 16px; }
.mini-list li { display: flex; gap: 14px; }
.mini-list img { width: 80px; height: 80px; object-fit: cover; background: var(--surface); border-radius: 8px; flex-shrink: 0; }
.mini-list div { display: flex; flex-direction: column; font-size: 15px; }

.guest-note { background: var(--surface); padding: 12px 16px; border-radius: 12px; margin-bottom: 8px; }
.step-title { font-size: 20px; margin: 28px 0 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field-label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.field input, .field select, .field textarea, .a-filters input, .a-filters select {
  width: 100%; padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 16px; transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.pay-options { display: grid; gap: 10px; }
.pay-opt { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; position: relative; }
.pay-opt:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.pay-opt::before { content: ''; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border); flex-shrink: 0; }
.pay-opt:has(input:checked)::before { border: 6px solid var(--ink); }
.pay-body { display: grid; flex: 1; }
.pay-icons { font-size: 22px; }
.checkout-form > .btn { margin-top: 28px; }
.checkout-form .small.center { margin-top: 10px; }

/* ---------- الطلبات والحساب ---------- */
.success-hero { text-align: center; padding: 48px 0 24px; display: grid; gap: 8px; justify-items: center; }
.check-circle { width: 72px; height: 72px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 36px; display: grid; place-items: center; }
.success-hero h1 { font-size: 32px; font-weight: 800; }
.order-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin: 24px 0; }
.order-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.order-meta > div { display: grid; gap: 2px; justify-items: start; }
.order-meta span.muted { font-size: 13px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: var(--pill); font-size: 13px; font-weight: 600; background: var(--surface); white-space: nowrap; }
.badge-pending { background: #fff4e5; color: #8a5300; }
.badge-processing { background: #eef3fd; color: #1f4fb8; }
.badge-shipped { background: #f1ebfd; color: #6231c4; }
.badge-delivered, .badge-pay-paid { background: #e6f4ea; color: var(--ok); }
.badge-cancelled, .badge-pay-failed { background: #fdecea; color: var(--sale); }
.badge-pay-pending { background: #f5f5f5; color: var(--muted); }
.badge-pay-refunded { background: #f1ebfd; color: #6231c4; }
.progress-steps { list-style: none; padding: 0; margin: 20px 0; display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; font-size: 13px; color: var(--muted); }
.progress-steps li { position: relative; display: grid; justify-items: center; gap: 6px; }
.progress-steps li span { width: 16px; height: 16px; border-radius: 50%; background: var(--line); position: relative; z-index: 1; }
.progress-steps li::before { content: ''; position: absolute; top: 7px; height: 2px; background: var(--line); inset-inline: -50% 50%; }
.progress-steps li:first-child::before { display: none; }
.progress-steps li.done { color: var(--ink); font-weight: 600; }
.progress-steps li.done span, .progress-steps li.done::before { background: var(--ink); }

.account-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin: 16px 0 24px; overflow-x: auto; }
.tabs a { padding: 10px 0; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { border-bottom-color: var(--ink); }
.tabs em { font-style: normal; color: var(--muted); font-size: 13px; }
.order-cards { display: grid; gap: 10px; padding-bottom: 48px; }
.order-card { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; padding: 16px 20px; border: 1px solid var(--line); border-radius: 14px; transition: border-color .2s; }
.order-card:hover { border-color: var(--ink); }
.order-card > div:first-child { display: grid; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding-bottom: 48px; }
.card-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.stack { display: grid; gap: 14px; }
.stack h2 { font-size: 20px; }

.auth-body main { background: #fff; }
.auth-card { max-width: 460px; margin: 32px auto 64px; padding: 0 20px; display: grid; gap: 20px; }
.auth-logo { display: flex; align-items: center; gap: 6px; font-weight: 900; font-size: 28px; font-style: italic; }
.auth-card h1 { font-size: 28px; font-weight: 600; }

.info-page { padding-bottom: 64px; }
.info-page h2 { margin: 24px 0 12px; font-size: 20px; }
.prose { line-height: 1.9; color: var(--ink-2); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { padding: 12px 14px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 13px; color: var(--muted); font-weight: 600; background: #fafafa; }

/* ---------- الفوتر ---------- */
.site-footer { background: var(--ink); color: #fff; padding: 48px var(--gutter) 24px; margin-top: 48px; }
.footer-inner { max-width: 1440px; margin-inline: auto; }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.footer-cols h4 { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.footer-cols a, .footer-install { display: block; color: #a8a8a8; font-size: 14px; padding: 4px 0; background: none; border: 0; }
.footer-cols a:hover, .footer-install:hover { color: #fff; }
.footer-install { color: #fff; text-decoration: underline; }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: #a8a8a8; font-size: 13px; margin-top: 40px; padding-top: 20px; border-top: 1px solid #2d2d2d; }

/* شريط التنقل السفلي (يظهر على الجوال فقط) */
.bottom-nav { display: none; }
.ios-hint { position: fixed; inset-inline: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 70; background: var(--ink); color: #fff; padding: 14px 16px; border-radius: 16px; display: flex; gap: 12px; align-items: center; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.ios-hint .icon-btn { color: #fff; flex-shrink: 0; }
.ios-hint .icon-btn:hover { background: rgba(255,255,255,.1); }

/* ==========================================================
   التجاوب مع الشاشات
   ========================================================== */
@media (max-width: 1100px) {
  .main-nav a { padding-inline: 8px; }
  .search-pill { width: 150px; }
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 960px) {
  .main-nav { display: none; }
  .menu-toggle { display: inline-grid; }
  .header-inner { gap: 4px; }
  .search-pill { width: auto; flex: 0 1 160px; }

  .shop-layout { grid-template-columns: 1fr; }
  .filter-toggle { display: inline-flex; }
  .filters { position: fixed; inset: 0; z-index: 100; display: none; }
  .filters.open { display: block; }
  .filters-backdrop { display: block; position: absolute; inset: 0; background: rgba(0,0,0,.35); }
  .filters-panel { position: absolute; inset: auto 0 0 0; max-height: 88vh; top: auto; background: #fff; border-radius: 20px 20px 0 0; padding: 0 20px; animation: up .25s ease; }
  .filters-top { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; padding: 16px 0 8px; z-index: 1; font-size: 18px; }
  @keyframes up { from { transform: translateY(100%); } }

  .pdp { grid-template-columns: 1fr; gap: 24px; padding-top: 0; padding-inline: 0; }
  .pdp-gallery { position: static; grid-template-columns: 1fr; }
  .pdp-thumbs { display: none; }
  .pdp-main { border-radius: 0; }
  .pdp-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
  .pdp-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--border); transition: all .2s; }
  .pdp-dots span.active { background: var(--ink); width: 18px; border-radius: 3px; }
  .pdp-info { padding-inline: var(--gutter); }

  .cart-page, .checkout-page { grid-template-columns: 1fr; gap: 16px; }
  .summary { position: static; }
  .checkout-page .summary { order: -1; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-top: 16px; }
}

@media (max-width: 700px) {
  :root { --header-h: 56px; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .hide-mobile, .search-pill { display: none; }
  .header-inner { justify-content: space-between; }
  .logo { position: absolute; left: 50%; transform: translateX(-50%); }
  .header-actions { margin-inline-start: 0; }
  .promo-bar { font-size: 12px; }

  .hero { min-height: 78vh; }
  .hero-copy { padding-bottom: 36px; }
  .hero-copy .btn-row .btn { flex: 1; }
  .section { padding-top: 36px; }
  .carousel-ctrl .round-btn { display: none; }
  .rail { grid-auto-columns: 72%; gap: 10px; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); }
  .tiles { grid-template-columns: 1fr; }
  .tile { aspect-ratio: 4 / 3; }
  .tile-label { bottom: 20px; inset-inline-start: 20px; }
  .banner { min-height: 440px; }
  .perks { grid-template-columns: 1fr; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 20px 8px; }
  .card-title { font-size: 15px; }
  .card-sub { font-size: 14px; }
  .tag { font-size: 12px; top: 8px; inset-inline-start: 8px; }

  .shop-head { padding-block: 12px; }
  .shop-head h1 { width: 100%; }
  .shop-tools { width: 100%; justify-content: space-between; }

  .cart-item { grid-template-columns: 100px 1fr; gap: 14px; }
  .form-grid, .settings-grid, .order-meta { grid-template-columns: 1fr; }
  .order-card { grid-template-columns: 1fr auto; }
  .order-card > div:last-child { grid-column: 1 / -1; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
  .footer-cols > div:last-child { grid-column: 1 / -1; }
  .added-toast { inset-inline: 12px; width: auto; }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; inset-inline: 0; z-index: 55;
    background: rgba(255,255,255,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11px; color: var(--muted); position: relative; }
  .bottom-nav a.active { color: var(--ink); font-weight: 600; }
  .bn-count { position: absolute; top: 4px; inset-inline-start: calc(50% + 6px); background: var(--ink); color: #fff; font-style: normal; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
}

/* وضع التطبيق المثبّت */
@media (display-mode: standalone) {
  .promo-bar { padding-top: max(8px, env(safe-area-inset-top)); }
  .install-trigger { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .site-footer, .bottom-nav, .promo-bar, .a-nav, .a-top, .btn, form { display: none !important; }
}
