/* ────────────────────────────────────────────────────────────────
   FiLLi Cafe — Country menu "aqlut-style" redesign + QR table view

   Layered ON TOP of menu-cards.css / menu-nav.css. Everything is scoped
   under `.cm-v2` (the country menu wrapper) so the shared UAE menu-hub
   and store-detail pages that reuse .fm-card are NOT affected.

   `body.qr-mode` = the chrome-hidden table view (?qr=1): tighter density.
   Colours follow the live site theme: brown #3f2016, saffron #fc5007,
   cream #faf8f5.
   ──────────────────────────────────────────────────────────────── */

.cm-v2 {
    --qm-brown: #3f2016;
    --qm-orange: #fc5007;
    --qm-cream: #faf5ef;
    --qm-rail-top: var(--nav-total, 82px);   /* sticks below the fixed site nav */
}

/* position:sticky fix — global ancestors set overflow-x:hidden, which
   coerces overflow-y to auto and makes .body-wrapper/body a scroll
   container, breaking the sticky QR bar + chip rail. overflow-x:clip
   prevents horizontal scroll WITHOUT establishing a scroll container, so
   sticky works against the viewport. Scoped to menu pages via :has(.cm-v2). */
body:has(.cm-v2) { overflow-x: clip !important; }
body:has(.cm-v2) .body-wrapper { overflow-x: clip !important; }

/* ── STICKY CHIP RAIL + SEARCH ─────────────────────────────────── */
.qm-rail {
    position: sticky;
    top: var(--qm-rail-top);
    z-index: 90;
    background: var(--qm-cream);
    border-bottom: 1px solid rgba(63, 32, 22, 0.06);
    padding: 12px 0 12px;
}
.qm-rail-inner { display: flex; flex-direction: column; gap: 10px; }

.qm-chips {
    display: flex; gap: 10px;
    overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none; -ms-overflow-style: none;
    padding: 2px 2px 4px;
    scroll-snap-type: x proximity;
}
.qm-chips::-webkit-scrollbar { display: none; }

.qm-chip {
    position: relative; flex: 0 0 auto;
    width: 88px; height: 92px;
    border-radius: 14px; overflow: hidden;
    background: var(--qm-brown);
    border: 2px solid transparent;
    text-decoration: none !important;
    scroll-snap-align: start;
    transition: transform .18s ease, border-color .18s ease;
}
.qm-chip:hover { transform: translateY(-2px); }
.qm-chip-img { position: absolute; inset: 0; background-size: cover; background-position: center; }
.qm-chip::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(28,14,6,0.15) 0%, rgba(28,14,6,0.72) 100%);
}
.qm-chip-label {
    position: absolute; inset: 0; z-index: 1;
    display: flex; align-items: center; justify-content: center; text-align: center;
    padding: 6px; color: #fff; font-size: 11px; font-weight: 700;
    line-height: 1.2; text-transform: uppercase; letter-spacing: 0.3px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.45);
}
.qm-chip.active { border-color: var(--qm-orange); }
.qm-chip.active::after { background: linear-gradient(180deg, rgba(252,80,7,0.10) 0%, rgba(28,14,6,0.75) 100%); }

/* Search field */
.qm-search {
    display: flex; align-items: center; gap: 8px;
    background: #fff; border: 1px solid rgba(63,32,22,0.14);
    border-radius: 980px; padding: 9px 16px;
}
.qm-search i { color: #b39b83; font-size: 0.95rem; }
.qm-search input {
    flex: 1; border: none; outline: none; background: transparent;
    font-size: 0.9rem; color: var(--qm-brown);
}
.qm-search input::placeholder { color: #b39b83; }

/* No-results notice (JS-toggled) */
.qm-no-results {
    display: none; text-align: center; color: var(--qm-text, #555);
    padding: 40px 0; font-size: 0.9rem;
}
.qm-no-results.show { display: block; }

/* ── SECTION BANNERS ───────────────────────────────────────────── */
.cm-v2 .qm-banner {
    position: relative; overflow: hidden;
    border-radius: 16px; margin: 6px 0 20px;
    min-height: 132px; display: flex; align-items: center; justify-content: center;
    background: var(--qm-brown);
}
.cm-v2 .qm-banner-img { position: absolute; inset: 0; background-size: cover; background-position: center; }
.cm-v2 .qm-banner::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(28,14,6,0.25) 0%, rgba(28,14,6,0.6) 100%);
}
.cm-v2 .qm-banner h2 {
    position: relative; z-index: 1; margin: 0;
    color: #fff; font-size: 1.5rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.5px; text-align: center;
    text-shadow: 0 2px 10px rgba(0,0,0,0.4);
}
/* Collections keep their brand accent colour on the banner */
.cm-v2 .qm-banner--collection h2 { }

/* ── CARD POLISH (scoped to .cm-v2 only) ───────────────────────── */
.cm-v2 .fm-section { padding: 8px 0 12px; }
.cm-v2 .fm-card-grid { gap: 16px; }
.cm-v2 .fm-card { border-radius: 16px; border-color: rgba(63,32,22,0.10); }
.cm-v2 .fm-card-top { padding: 14px; gap: 14px; align-items: flex-start; }
.cm-v2 .fm-card-thumb { width: 92px; height: 92px; border-radius: 12px; }
.cm-v2 .fm-card-info h3 { font-size: 0.95rem; margin-bottom: 5px; }
.cm-v2 .fm-card-price {
    display: inline-block; font-size: 0.95rem; font-weight: 800;
    color: var(--qm-orange); margin: 4px 0 2px;
}
.cm-v2 .fm-card-desc-preview { font-size: 0.74rem; -webkit-line-clamp: 2; }
/* LTR: photo on the RIGHT (aqlut layout). RTL mirrors naturally. */
html[dir="ltr"] .cm-v2 .fm-card-top { flex-direction: row-reverse; }

/* Anchor landings clear the sticky nav + chip rail */
.cm-v2 .fm-section[id] { scroll-margin-top: calc(var(--qm-rail-top) + 118px); }

/* ── QR-MODE COMPACT DENSITY (table view only) ─────────────────── */
body.qr-mode .cm-v2 { --qm-rail-top: 64px; }        /* sticks below the 64px QR bar */
/* No fixed site nav in QR mode — the body-wrapper's nav-clearance padding
   would otherwise leave a gap above the sticky QR bar. */
body.qr-mode .body-wrapper { padding-top: 0 !important; }
/* No fixed site nav in QR mode — undo the global hero pull-up/clearance so
   the hero doesn't slide under the in-flow sticky QR bar. */
body.qr-mode .cm-hero { margin-top: 0 !important; padding-top: 18px !important; }
body.qr-mode .cm-hero .sl-breadcrumbs { display: none; }
body.qr-mode .cm-v2 .qm-banner { min-height: 104px; border-radius: 14px; margin-bottom: 16px; }
body.qr-mode .cm-v2 .qm-banner h2 { font-size: 1.25rem; }
body.qr-mode .cm-v2 .fm-card { border-radius: 14px; }
body.qr-mode .cm-v2 .fm-card-top { padding: 12px; }

/* ── RESPONSIVE ────────────────────────────────────────────────── */
@media (max-width: 575px) {
    .qm-chip { width: 78px; height: 84px; }
    .qm-chip-label { font-size: 10px; }
    .cm-v2 .qm-banner { min-height: 108px; }
    .cm-v2 .qm-banner h2 { font-size: 1.25rem; }
    .cm-v2 .fm-card-thumb { width: 82px; height: 82px; }
}
