/* =====================================================================
   site.css — تصميم الموقع العام (أبو ليحا للعطور)
   هوية الشعار: برتقالي محمر #D93A02 + فحمي #211F20
   - وضع فاتح/داكن عبر [data-theme]
   - أولوية الجوال (mobile-first)، RTL
   - بدون مكتبات؛ أيقونات SVG مضمّنة
   ===================================================================== */

/* ---------- 1) المتغيرات ---------- */
:root {
    --brand: #D93A02;
    --brand-600: #B82F00;
    --brand-soft: rgba(217, 58, 2, 0.09);
    --logo-ink: #211F20;

    --ink: #211F20;
    --ink-2: #4A4647;
    --muted: #7A7576;

    --bg: #FFFFFF;
    --bg-alt: #FAF7F2;
    --surface: #FFFFFF;
    --border: #E9E4DC;

    --ok: #0E8F5B;
    --warn: #B7791F;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 3px rgba(33, 31, 32, .08);
    --shadow: 0 6px 22px rgba(33, 31, 32, .10);
    --shadow-brand: 0 8px 22px rgba(217, 58, 2, .28);

    --header-h: 64px;
    --container: 1200px;
    --font: 'Cairo', 'Segoe UI', Tahoma, system-ui, sans-serif;

    color-scheme: light;
}

[data-theme="dark"] {
    --brand: #F0592B;
    --brand-600: #D93A02;
    --brand-soft: rgba(240, 89, 43, 0.15);
    --logo-ink: #F4F0EA;

    --ink: #F4F0EA;
    --ink-2: #CFC8C0;
    --muted: #9A938B;

    --bg: #131112;
    --bg-alt: #1A1718;
    --surface: #1F1C1D;
    --border: #342F30;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
    --shadow: 0 6px 22px rgba(0, 0, 0, .45);

    color-scheme: dark;
}

/* ---------- 2) الأساس ---------- */
/* خاصية hidden يجب أن تغلب أي display مكتوب في التنسيقات (مثل grid) */
[hidden] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.7;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background-color .2s ease, color .2s ease;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
ul { list-style: none; }
h1, h2, h3, h4 { line-height: 1.35; font-weight: 800; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 16px; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link {
    position: absolute; top: -60px; inset-inline-start: 12px; z-index: 1000;
    background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.skip-link:focus { top: 0; }

/* أيقونات SVG */
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.i-lg { width: 30px; height: 30px; }
.i-xl { width: 44px; height: 44px; }

/* ---------- 3) أزرار ونماذج ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 22px; border-radius: 999px; font-weight: 700; font-size: .95rem; line-height: 1.4;
    border: 2px solid transparent; transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease;
    min-height: 46px; text-align: center;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { background: var(--brand-600); }
.btn-outline { border-color: var(--brand); color: var(--brand); background: transparent; }
.btn-outline:hover { background: var(--brand-soft); }
.btn-wa { background: #1FAF5A; color: #fff; }
.btn-wa:hover { background: #178f49; }
.btn-block { width: 100%; }

.icon-btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 50%; color: var(--ink);
    transition: background-color .2s ease;
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); }

.count-badge {
    position: absolute; top: 2px; inset-inline-end: 0; min-width: 19px; height: 19px; padding: 0 5px;
    border-radius: 999px; background: var(--brand); color: #fff; font-size: .7rem; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.count-badge[hidden] { display: none; }

/* ---------- 4) الترويسة ---------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.header-row { display: flex; align-items: center; gap: 8px; min-height: var(--header-h); position: relative; }

.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 42px; height: 42px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 1.02rem; white-space: nowrap; }
.brand-sub { font-size: .6rem; letter-spacing: 2.5px; color: var(--brand); font-weight: 700; }

.main-nav { display: none; gap: 4px; margin-inline-start: 12px; }
.main-nav a { padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: .92rem; color: var(--ink-2); }
.main-nav a:hover, .main-nav a.is-active { color: var(--brand); background: var(--brand-soft); }

.header-actions { display: flex; align-items: center; gap: 2px; margin-inline-start: auto; }
.menu-btn { margin-inline-start: -8px; }

/* البحث: على الجوال يظهر تحت الترويسة عند الضغط */
.search-form {
    position: absolute; top: 100%; inset-inline: 0; display: none;
    padding: 10px 16px 14px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.search-form.is-open { display: block; }
.search-input {
    width: 100%; height: 48px; padding-inline: 18px 52px; border-radius: 999px;
    background: var(--bg-alt); border: 2px solid var(--border); outline: none; font-size: 16px;
    transition: border-color .2s ease, background-color .2s ease;
}
.search-input:focus { border-color: var(--brand); background: var(--surface); }
.search-btn { position: absolute; top: 10px; inset-inline-end: 22px; height: 48px; width: 40px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.search-suggest {
    position: absolute; inset-inline: 16px; top: calc(100% - 4px); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; z-index: 10;
}

/* وضع فاتح/داكن: إظهار الأيقونة المناسبة */
.theme-ico-light { display: none; }
[data-theme="dark"] .theme-ico-light { display: inline-flex; }
[data-theme="dark"] .theme-ico-dark { display: none; }

/* القائمة الجانبية (جوال) */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 190; }
.drawer-overlay[hidden], .drawer[hidden] { display: none; }
.drawer {
    position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(86vw, 320px); z-index: 200;
    background: var(--surface); display: flex; flex-direction: column; box-shadow: var(--shadow);
    padding-bottom: env(safe-area-inset-bottom);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.drawer-nav { overflow-y: auto; padding: 8px 8px 24px; display: flex; flex-direction: column; }
.drawer-nav a { padding: 13px 14px; border-radius: var(--radius-sm); font-weight: 700; }
.drawer-nav a:hover { background: var(--brand-soft); color: var(--brand); }
.drawer-title { padding: 16px 14px 6px; font-size: .78rem; font-weight: 800; color: var(--muted); letter-spacing: .5px; }

/* ---------- 5) الأقسام العامة ---------- */
.section { padding: 40px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.section-title { font-size: 1.45rem; position: relative; padding-inline-start: 14px; }
.section-title::before { content: ''; position: absolute; inset-inline-start: 0; top: 18%; bottom: 18%; width: 5px; border-radius: 4px; background: var(--brand); }
.section-sub { color: var(--muted); font-size: .92rem; margin-top: 2px; }
.link-more { color: var(--brand); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.link-more .i { width: 18px; height: 18px; }

/* ---------- 6) الرئيسية: البطل ---------- */
.hero { background: var(--bg-alt); position: relative; overflow: hidden; }
.hero::before {
    content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%;
    inset-inline-start: -180px; top: -200px; background: radial-gradient(circle, var(--brand-soft), transparent 68%);
    pointer-events: none;
}
.hero-grid { display: grid; gap: 28px; align-items: center; padding-block: 36px 44px; position: relative; }
.hero-eyebrow { display: inline-block; font-size: .8rem; font-weight: 800; color: var(--brand); background: var(--brand-soft); padding: 4px 14px; border-radius: 999px; margin-bottom: 14px; }
.hero h1 { font-size: clamp(1.7rem, 5.5vw, 2.8rem); margin-bottom: 14px; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p { color: var(--ink-2); max-width: 54ch; margin-bottom: 22px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-art { display: none; justify-self: center; }
.hero-art svg { width: min(340px, 70vw); height: auto; filter: drop-shadow(0 18px 30px rgba(217, 58, 2, .18)); }

.features { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: -22px; position: relative; z-index: 2; }
.feature { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.feature .i { color: var(--brand); width: 28px; height: 28px; }
.feature strong { display: block; font-size: .95rem; }
.feature span { font-size: .82rem; color: var(--muted); }

/* ---------- 7) البطاقات والشبكات ---------- */
.grid-cats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cat-card {
    position: relative; display: block; border-radius: var(--radius); overflow: hidden; background: var(--bg-alt);
    border: 1px solid var(--border); aspect-ratio: 4 / 3; transition: transform .2s ease, box-shadow .2s ease;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.cat-card img { width: 100%; height: 100%; object-fit: cover; transition: opacity .35s ease; }
.js .cat-card img[data-fade]:not(.is-loaded) { opacity: 0; }
.cat-card-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--brand); background: linear-gradient(135deg, var(--brand-soft), transparent); }
.cat-card-label {
    position: absolute; inset-inline: 0; bottom: 0; padding: 26px 12px 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .72)); color: #fff;
}
.cat-card-label strong { display: block; font-size: 1rem; }
.cat-card-label small { opacity: .85; font-size: .75rem; }

.brands-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.brand-chip {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-height: 96px;
    text-align: center; transition: border-color .2s ease, transform .2s ease;
}
.brand-chip:hover { border-color: var(--brand); transform: translateY(-2px); }
.brand-chip img { width: 64px; height: 44px; object-fit: contain; }
.brand-chip span { font-size: .82rem; font-weight: 700; }

.grid-products { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.p-card {
    position: relative; display: flex; flex-direction: column; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.p-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.p-card-media { display: block; aspect-ratio: 1 / 1; background: var(--bg-alt); overflow: hidden; }
.p-card-media img { width: 100%; height: 100%; object-fit: cover; transition: opacity .35s ease, transform .4s ease; }
.js .p-card-media img[data-fade]:not(.is-loaded) { opacity: 0; }
.p-card:hover .p-card-media img { transform: scale(1.04); }
.p-card-noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.p-card-fav {
    position: absolute; top: 8px; inset-inline-end: 8px; width: 38px; height: 38px; border-radius: 50%;
    background: color-mix(in srgb, var(--surface) 90%, transparent); display: flex; align-items: center; justify-content: center;
    color: var(--ink-2); box-shadow: var(--shadow-sm); transition: color .2s ease, transform .15s ease;
}
.p-card-fav:active { transform: scale(.9); }
.p-card-fav .i { width: 20px; height: 20px; }
.p-card-fav.is-active { color: var(--brand); }
.p-card-fav.is-active .i { fill: var(--brand); }
.p-card-body { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 14px; flex: 1; }
.p-card-brand { font-size: .74rem; font-weight: 700; color: var(--brand); }
.p-card-title { font-size: .95rem; font-weight: 700; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.p-card-title a:hover { color: var(--brand); }
.p-card-price { margin-top: auto; padding-top: 6px; display: flex; flex-direction: column; gap: 1px; }
.p-card-opt { font-size: .74rem; color: var(--muted); }
.price { font-size: 1.05rem; font-weight: 800; color: var(--brand); }
.p-card-ask { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 700; color: #1FAF5A; }
.p-card-ask .i { width: 18px; height: 18px; }
.p-card-ask-text { font-size: .85rem; font-weight: 700; color: var(--muted); }

.empty-box { text-align: center; padding: 36px 16px; color: var(--muted); border: 2px dashed var(--border); border-radius: var(--radius); }

.cta-band { background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: #fff; border-radius: var(--radius-lg); padding: 28px 22px; display: grid; gap: 14px; text-align: center; }
.cta-band h2 { font-size: 1.35rem; }
.cta-band p { opacity: .92; }
.cta-band .btn { background: #fff; color: var(--brand-600); justify-self: center; }

/* ---------- 8) صفحات ثابتة ---------- */
.page-head { background: var(--bg-alt); border-bottom: 1px solid var(--border); padding: 30px 0; }
.page-head h1 { font-size: clamp(1.5rem, 4.5vw, 2.1rem); }
.page-head p { color: var(--muted); margin-top: 4px; }
.prose { max-width: 70ch; }
.prose h2 { font-size: 1.25rem; margin: 26px 0 8px; }
.prose p { color: var(--ink-2); margin-bottom: 12px; }
.prose ul { padding-inline-start: 22px; list-style: disc; color: var(--ink-2); margin-bottom: 12px; }
.prose li { margin-bottom: 6px; }

.contact-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.contact-card { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.contact-card .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.contact-card h3 { font-size: .95rem; margin-bottom: 2px; }
.contact-card a, .contact-card p { color: var(--ink-2); word-break: break-word; }
.contact-card a:hover { color: var(--brand); }

.map-box { position: relative; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); background: var(--bg-alt); min-height: 300px; display: flex; align-items: center; justify-content: center; }
.map-box iframe { width: 100%; height: 100%; min-height: 360px; border: 0; }
.map-ph { text-align: center; padding: 28px 16px; display: grid; gap: 12px; justify-items: center; }
.map-ph .i { color: var(--brand); width: 48px; height: 48px; }

.social-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.social-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); transition: all .2s ease; }
.social-btn:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

.notfound { text-align: center; padding: 70px 16px; }
.notfound .code { font-size: clamp(4rem, 18vw, 7rem); font-weight: 800; color: var(--brand); line-height: 1; }
.notfound p { color: var(--muted); margin: 10px 0 22px; }

/* ---------- 9) الذيل ---------- */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--border); margin-top: 40px; }
.footer-grid { display: grid; gap: 28px; padding-block: 36px; grid-template-columns: 1fr 1fr; }
.footer-about { grid-column: 1 / -1; }
.brand-footer { margin-bottom: 10px; }
.footer-col h4 { font-size: .95rem; margin-bottom: 12px; }
.footer-col li { margin-bottom: 8px; color: var(--ink-2); font-size: .92rem; }
.footer-col a:hover { color: var(--brand); }
.contact-list li { display: flex; gap: 8px; align-items: flex-start; }
.contact-list .i { width: 18px; height: 18px; margin-top: 4px; color: var(--brand); }
.footer-bottom { border-top: 1px solid var(--border); padding-block: 14px; font-size: .82rem; color: var(--muted); text-align: center; }

/* ---------- 10) الأزرار العائمة ---------- */
.fab {
    position: fixed; z-index: 90; width: 56px; height: 56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: #fff; box-shadow: var(--shadow);
    transition: transform .2s ease, opacity .2s ease;
}
.fab:hover { transform: translateY(-3px); }
.fab-wa { left: 14px; bottom: calc(16px + env(safe-area-inset-bottom)); background: #1FAF5A; }
.fab-wa::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #1FAF5A; animation: pulse 2.4s ease-out infinite; }
.fab-scroll { position: fixed; z-index: 90; right: 14px; bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.fab-scroll .fab { position: static; }
.fab-sm { width: 44px; height: 44px; background: var(--ink); color: var(--bg); opacity: .85; }
.fab-sm[hidden] { display: none; }

@keyframes pulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.45); opacity: 0; } }

/* ---------- 11) الاستجابة ---------- */
@media (min-width: 640px) {
    .container { padding-inline: 24px; }
    .grid-cats { grid-template-columns: repeat(3, 1fr); gap: 16px; }
    .brands-row { grid-template-columns: repeat(4, 1fr); }
    .grid-products { grid-template-columns: repeat(3, 1fr); gap: 16px; }
    .features { grid-template-columns: repeat(3, 1fr); }
    .contact-grid { grid-template-columns: 1fr 1fr; }
    .footer-grid { grid-template-columns: repeat(3, 1fr); }
    .footer-about { grid-column: auto; }
}

@media (min-width: 960px) {
    :root { --header-h: 72px; }
    .menu-btn, .search-toggle { display: none; }
    .main-nav { display: flex; }
    .search-form { position: relative; display: block; inset: auto; padding: 0; background: none; border: 0; flex: 1; max-width: 420px; margin-inline: 10px; }
    .search-input { height: 44px; }
    .search-btn { top: 0; inset-inline-end: 6px; height: 44px; }
    .search-suggest { inset-inline: 0; top: calc(100% + 6px); }
    .header-actions { margin-inline-start: 0; }
    .hero-grid { grid-template-columns: 1.2fr .8fr; padding-block: 56px 64px; }
    .hero-art { display: block; }
    .grid-cats { grid-template-columns: repeat(4, 1fr); }
    .brands-row { grid-template-columns: repeat(6, 1fr); }
    .grid-products { grid-template-columns: repeat(4, 1fr); }
    .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1.3fr; }
    .cta-band { grid-template-columns: 1fr auto; text-align: start; align-items: center; padding: 30px 36px; }
    .cta-band .btn { justify-self: end; }
    .contact-grid { grid-template-columns: repeat(3, 1fr); }
}

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

@media print { .site-header, .site-footer, .fab, .fab-scroll { display: none !important; } }

/* =====================================================================
   المرحلة 2: القوائم وصفحة المنتج
   ===================================================================== */

.btn-sm { padding: 7px 16px; min-height: 38px; font-size: .85rem; }

.select {
    height: 42px; padding-inline: 14px 34px; border-radius: 999px; border: 2px solid var(--border);
    background: var(--surface); font-weight: 600; font-size: 16px; cursor: pointer;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23999' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: left 12px center; background-size: 12px;
}
.select:focus { border-color: var(--brand); outline: none; }

/* فتات الخبز */
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: .84rem; color: var(--muted); margin-bottom: 10px; }
.breadcrumbs li + li::before { content: '‹'; margin-inline-end: 8px; opacity: .6; }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs [aria-current] { color: var(--ink-2); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .85rem; font-weight: 700; }
.chip em { font-style: normal; color: var(--muted); font-weight: 600; margin-inline-start: 4px; }
.chip:hover { border-color: var(--brand); color: var(--brand); }

.brand-head { display: flex; align-items: center; gap: 16px; }
.brand-head-logo { width: 72px; height: 72px; object-fit: contain; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; }

/* شريط القائمة */
.listing-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.listing-count { color: var(--muted); }
.listing-count strong { color: var(--ink); }
.listing-tools { display: flex; align-items: center; gap: 8px; }
.sort-form { display: inline-block; }

.listing-layout { display: block; }

/* الفلاتر: درج سفلي على الجوال */
.filters-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 190; }
.filters-overlay[hidden] { display: none; }
.filters {
    position: fixed; inset-inline: 0; bottom: 0; max-height: 86dvh; z-index: 200; background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow);
    display: flex; flex-direction: column; transform: translateY(105%); transition: transform .25s ease; visibility: hidden;
}
.filters.is-open { transform: none; visibility: visible; }
.filters-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 8px 8px; border-bottom: 1px solid var(--border); }
.filters-form { overflow-y: auto; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); }
.f-group { border-bottom: 1px solid var(--border); padding: 10px 0; }
.f-group summary { cursor: pointer; font-weight: 800; padding: 6px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.f-group summary::-webkit-details-marker { display: none; }
.f-group summary::after { content: '+'; color: var(--muted); font-size: 1.2rem; }
.f-group[open] summary::after { content: '−'; }
.f-options { display: flex; flex-direction: column; gap: 2px; padding-top: 6px; max-height: 260px; overflow-y: auto; }
.f-check { display: flex; align-items: center; gap: 10px; padding: 8px 4px; cursor: pointer; border-radius: 8px; }
.f-check:hover { background: var(--brand-soft); }
.f-check input { width: 20px; height: 20px; accent-color: var(--brand); flex-shrink: 0; }
.f-check span { flex: 1; }
.f-check em { font-style: normal; font-size: .78rem; color: var(--muted); }
.filters-actions { display: grid; gap: 8px; margin-top: 16px; }

.load-more { text-align: center; margin: 26px 0 8px; }

/* صفحة المنتج */
.product-layout { display: grid; gap: 22px; }
.gallery-main { aspect-ratio: 1 / 1; background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.thumb { width: 68px; height: 68px; flex-shrink: 0; border-radius: var(--radius-sm); overflow: hidden; border: 2px solid var(--border); background: var(--bg-alt); opacity: .75; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.is-active, .thumb:hover { border-color: var(--brand); opacity: 1; }

.product-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.p-brand { color: var(--brand); font-weight: 800; font-size: .9rem; }
.p-title { font-size: clamp(1.4rem, 4.5vw, 2rem); }
.p-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .86rem; }
.p-meta a { color: var(--ink-2); font-weight: 700; }
.p-meta a:hover { color: var(--brand); }
.p-short { color: var(--ink-2); }
.p-actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.p-actions-row [data-fav-toggle].is-active { border-color: var(--brand); background: var(--brand-soft); }
.p-actions-row [data-fav-toggle].is-active .i { fill: var(--brand); }

.options { display: grid; gap: 12px; margin-top: 6px; }
.options-title, .info-title { font-size: 1.05rem; margin-bottom: 2px; }
.info-title { margin: 18px 0 8px; }

.opt-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; }
.opt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.opt-name { font-weight: 800; font-size: 1.05rem; }
.opt-price strong { color: var(--brand); font-size: 1.25rem; font-weight: 800; }
.opt-price small { color: var(--muted); }

.opt-range { width: 100%; height: 32px; accent-color: var(--brand); cursor: pointer; direction: ltr; }
.opt-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.opt-add { flex: 1; min-width: 150px; }
.opt-note { font-size: .8rem; color: var(--muted); }

.qty-box { display: inline-flex; align-items: center; border: 2px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--bg); }
.qty-btn { width: 42px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--ink-2); }
.qty-btn:hover { background: var(--brand-soft); color: var(--brand); }
.qty-btn .i { width: 18px; height: 18px; }
.qty-input { width: 64px; height: 44px; text-align: center; border: 0; background: transparent; font-weight: 800; font-size: 16px; outline: none; -moz-appearance: textfield; }
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.tier-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tier-table th { text-align: start; color: var(--muted); font-weight: 700; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.tier-table td { padding: 7px 10px; border-bottom: 1px dashed var(--border); }
.tier-table tr.is-active td { background: var(--brand-soft); color: var(--brand); font-weight: 800; }

.inquiry-box { background: var(--bg-alt); border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; justify-items: start; }

.attr-list { display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.attr-list > div { display: grid; grid-template-columns: 38% 1fr; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.attr-list > div:last-child { border-bottom: 0; }
.attr-list dt { color: var(--muted); font-weight: 700; }
.attr-list dd { font-weight: 600; }
.attr-list > div:nth-child(odd) { background: var(--bg-alt); }

.p-desc { margin-top: 28px; }
.similar { margin-top: 36px; }

/* إشعار */
.toast {
    position: fixed; z-index: 300; inset-inline: 14px; bottom: calc(86px + env(safe-area-inset-bottom));
    max-width: 480px; margin-inline: auto; background: var(--ink); color: var(--bg); padding: 12px 16px;
    border-radius: var(--radius); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; gap: 12px;
    opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; font-size: .9rem;
}
.toast.is-show { opacity: 1; transform: none; pointer-events: auto; }
.toast a { color: var(--brand); font-weight: 800; white-space: nowrap; filter: brightness(1.25); }

@media (min-width: 960px) {
    .product-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
    .gallery { position: sticky; top: calc(var(--header-h) + 16px); }

    /* الفلاتر: شريط جانبي ثابت */
    .listing-layout.has-filters { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; align-items: start; }
    .filters {
        position: sticky; top: calc(var(--header-h) + 14px); inset: auto; transform: none; visibility: visible;
        max-height: calc(100dvh - var(--header-h) - 28px); border: 1px solid var(--border); border-radius: var(--radius);
        box-shadow: none; z-index: 1;
    }
    .filters-head [data-filters-close], .filters-open { display: none; }
    .filters-head { padding: 12px 16px; }
    .filters-actions .btn-primary { display: none; }
    .toast { inset-inline: auto; inset-inline-start: 24px; margin: 0; }
}

/* =====================================================================
   المرحلة 3-4: السلة، البحث، المفضلة
   ===================================================================== */

.link-btn { color: var(--brand); font-weight: 700; font-size: .88rem; padding: 6px 4px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--brand-600); }

.alert-box { background: color-mix(in srgb, #e5484d 12%, var(--surface)); color: var(--ink); border: 1px solid color-mix(in srgb, #e5484d 45%, var(--border)); border-radius: var(--radius); padding: 12px 14px; font-size: .9rem; margin-bottom: 12px; display: grid; gap: 10px; }
.alert-box.is-ok { background: color-mix(in srgb, #1FAF5A 12%, var(--surface)); border-color: color-mix(in srgb, #1FAF5A 45%, var(--border)); }

/* السلة */
.cart-layout { display: grid; gap: 22px; }
.cart-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.cart-items { display: grid; gap: 12px; }
.cart-item { display: grid; grid-template-columns: 80px 1fr; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; position: relative; }
.cart-item.is-unavailable { grid-template-columns: 1fr auto; align-items: center; opacity: .75; }
.ci-img { width: 80px; height: 80px; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-alt); display: block; }
.ci-img img { width: 100%; height: 100%; object-fit: cover; }
.ci-body { min-width: 0; display: grid; gap: 4px; align-content: start; }
.ci-name { font-weight: 800; line-height: 1.4; }
.ci-name:hover { color: var(--brand); }
.ci-opt, .ci-unit { font-size: .84rem; color: var(--muted); }
.ci-unit b { color: var(--brand); font-size: .95rem; }
.ci-hint { font-size: .78rem; color: var(--ok); font-weight: 700; }
.ci-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.ci-sub { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; border-top: 1px dashed var(--border); padding-top: 8px; }
.ci-sub small { color: var(--muted); }
.ci-sub strong { font-size: 1.1rem; }

.cart-summary { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.cart-total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.cart-total-row strong { font-size: 1.5rem; color: var(--brand); }

.order-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.order-form h3 { font-size: 1.05rem; }
.field { display: grid; gap: 5px; }
.field label { font-weight: 700; font-size: .88rem; }
.field label small { color: var(--muted); font-weight: 600; }
.field .req { color: #e5484d; }
.field input, .field textarea {
    width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 2px solid var(--border);
    background: var(--bg); font-size: 16px; outline: none; transition: border-color .2s ease;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field textarea:focus { border-color: var(--brand); }

/* البحث */
.page-search { display: flex; gap: 8px; margin-top: 14px; max-width: 560px; }
.page-search input { flex: 1; min-width: 0; height: 48px; padding-inline: 18px; border-radius: 999px; border: 2px solid var(--border); background: var(--surface); font-size: 16px; outline: none; }
.page-search input:focus { border-color: var(--brand); }

.sg-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.sg-item:last-child { border-bottom: 0; }
.sg-item:hover, .sg-item.is-active { background: var(--brand-soft); }
.sg-tax { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 4px; }
.sg-chip { border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: .82rem; font-weight: 700; }
.sg-product img, .sg-noimg { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--bg-alt); flex-shrink: 0; }
.sg-text { display: grid; min-width: 0; flex: 1; }
.sg-text strong { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-text small { color: var(--brand); font-size: .75rem; font-weight: 700; }
.sg-price { font-weight: 800; color: var(--brand); font-size: .85rem; white-space: nowrap; }
.sg-all { justify-content: center; color: var(--brand); font-weight: 800; }
.sg-empty { padding: 14px; color: var(--muted); font-size: .88rem; text-align: center; }
.search-suggest[hidden] { display: none; }

@media (min-width: 960px) {
    .cart-layout { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
    .cart-side { position: sticky; top: calc(var(--header-h) + 16px); }
    .cart-item { grid-template-columns: 96px 1fr auto; }
    .ci-img { width: 96px; height: 96px; }
    .ci-sub { grid-column: auto; flex-direction: column; align-items: flex-end; border-top: 0; padding-top: 0; justify-content: center; }
}

/* الطلب: حقل الفخ، لوحة النجاح */
.hp { position: absolute !important; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.last-order { margin-top: 10px; font-size: .88rem; color: var(--ink-2); background: var(--brand-soft); border-radius: var(--radius-sm); padding: 8px 12px; display: inline-block; }
.order-success { max-width: 520px; margin: 10px auto; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px 20px; display: grid; gap: 10px; }
.order-success[hidden] { display: none; }
.order-success-ico { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto; background: color-mix(in srgb, #1FAF5A 16%, var(--surface)); color: #1FAF5A; display: flex; align-items: center; justify-content: center; }
.order-success strong { color: var(--brand); font-size: 1.15rem; }
