/* Reusable components — La Barra QR menu. */

/* ── Section header ─────────────────────────────────────────────────────── */
.section-header {
    position: relative;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sp4);
    margin-bottom: var(--sp5);
    padding-bottom: var(--sp3);
}

/*
 * Default state is the fully-drawn line (safe if JS/GSAP never runs — see
 * the "only ever hidden right before animating" rule in scroll-reveals.js).
 * When ScrollTrigger is available, js/scroll-reveals.js flips it to
 * scaleX(0) and animates it back in as the section enters the viewport.
 */
.section-header__underline {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 1px;
    background: var(--line-subtle);
    transform-origin: left;
    transform: scaleX(1);
}

.section-header__title {
    font-family: var(--font-display);
    text-transform: uppercase;
    font-size: clamp(33px, 5.4vw, 48px);
    color: var(--fg-primary);
}

.section-header__meta { display: flex; align-items: baseline; gap: var(--sp4); }
.section-header__count { color: var(--fg-tertiary); font-size: 12px; }
.section-header__link { display: inline-flex; align-items: center; gap: 4px; color: var(--fg-secondary); font-size: 13px; white-space: nowrap; }
.section-header__link:hover { color: var(--fg-primary); }
.section-header__link-icon { width: 14px; height: 14px; }

/* ── Horizontal shelves (offers / events) ──────────────────────────────── */
.shelf-section {
    position: relative;
    /* Establishes its own stacking context so the negative z-index on a
       nested .bg-grid overlay (base.css) stays contained here instead of
       slipping behind earlier sections on the page. */
    z-index: 0;
    padding: var(--sp7) var(--sp4);
}
.shelf-section--alt { background: var(--bg-alt); }

/* Desktop/tablet — the section keeps its full-bleed background band, only
   its header + shelf get capped/centered so they don't stretch edge-to-edge
   on wide screens. Scoped to .shelf-section so this never reaches the
   .product-detail__related shelf (a detail page, left as-is). Mobile is
   untouched. */
@media (min-width: 720px) {
    .shelf-section .section-header,
    .shelf-section .shelf {
        max-width: var(--container-max);
        margin-left: auto;
        margin-right: auto;
    }
}

.shelf {
    display: flex;
    gap: var(--sp4);
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding-bottom: var(--sp2);
    scrollbar-width: none;
}

.shelf::-webkit-scrollbar { display: none; }
.shelf > * { scroll-snap-align: start; flex-shrink: 0; }

/* ── Featured card (column: image top, content below) ─────────────────── */
.card-featured {
    width: 150px;
    background: var(--surface-1);
    border: 1px solid var(--line-subtle);
    box-shadow: var(--shadow-1);
    display: block;
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--dur-fast) var(--ease-brand), box-shadow var(--dur-fast) var(--ease-brand), border-color var(--dur-fast) var(--ease-brand);
}

.card-featured:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-2);
    border-color: var(--line);
}

@media (min-width: 640px) { .card-featured { width: 180px; } }

/* Bigger cards on desktop for the horizontal shelves on index pages
   (offers/combos/featured on /menu, per-category combos, home's
   Destacados/Eventos grid below). Scoped so it never reaches
   .product-detail__related's "también te puede interesar" shelf on the
   product/combo detail pages, which stay as-is. */
@media (min-width: 1100px) {
    .shelf-section .card-featured,
    .category-panel__combos .card-featured {
        width: 220px;
    }
}

.card-featured__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2); }
.card-featured__media img { width: 100%; height: 100%; object-fit: cover; filter: var(--image-filter); }
.card-featured__badge { position: absolute; top: var(--sp2); left: var(--sp2); }

.card-featured__body { padding: var(--sp3); }

.card-featured__name {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    color: var(--fg-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.card-featured__price { display: block; margin-top: var(--sp2); font-size: 17px; font-weight: 700; color: var(--fg-primary); }
.card-featured__price-original { color: var(--fg-tertiary); text-decoration: line-through; font-size: 12px; font-weight: 400; margin-right: var(--sp2); }
.card-featured__note { display: block; margin-top: var(--sp2); font-size: 11px; color: var(--fg-tertiary); }

/* ── Category panel + row card (image left, content right) ────────────── */
.category-panel {
    padding: var(--sp8) var(--sp6) var(--sp6);
    border-bottom: 1px solid var(--line-subtle);
}

.category-panel:nth-of-type(odd) { background: var(--bg); }
.category-panel:nth-of-type(even) { background: var(--bg-alt); }

.category-panel__list { display: flex; flex-direction: column; gap: var(--sp3); }

/* Combos assigned to this category (product_groups.category_id) — a small
   shelf appended under the regular product rows, reusing the same
   .card-featured partial as the top "Ofertas y combos" shelf. */
.category-panel__combos {
    display: flex;
    gap: var(--sp3);
    overflow-x: auto;
    margin-top: var(--sp5);
    padding-top: var(--sp5);
    border-top: 1px solid var(--line-subtle);
}

/* Desktop/tablet — product rows go multi-column instead of one long
   full-width stack, and the section header, list and combos shelf all get
   the same cap/center so they line up. Cards get a bit more breathing room
   too. Mobile is untouched. */
@media (min-width: 720px) {
    .category-panel .section-header,
    .category-panel__list,
    .category-panel__combos {
        max-width: var(--container-max);
        margin-left: auto;
        margin-right: auto;
    }

    .category-panel__list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--sp4);
    }

    .category-panel__list .card-row { min-height: 108px; }
    .category-panel__list .card-row__media { max-width: 140px; }
    .category-panel__list .card-row__name { font-size: 18px; }
}

@media (min-width: 1100px) {
    .category-panel__list { grid-template-columns: repeat(3, 1fr); }
}

/* Parent category closed by the owner (category-visibility hotfix) — same
   panel rhythm as a regular section, centered muted message instead of
   product rows. See CategoryVisibilityService / MenuChromeService::categoryParents(). */
.category-panel--closed {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 96px;
    text-align: center;
}

.category-panel__closed-message {
    color: var(--fg-tertiary);
    font-style: italic;
}

.card-row {
    display: flex;
    gap: var(--sp4);
    min-height: 92px;
    background: var(--surface-1);
    border: 1px solid var(--line-subtle);
    box-shadow: var(--shadow-1);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: opacity var(--dur-fast) var(--ease-brand), transform var(--dur-fast) var(--ease-brand), box-shadow var(--dur-fast) var(--ease-brand), border-color var(--dur-fast) var(--ease-brand);
}

.card-row:hover { border-color: var(--line); box-shadow: var(--shadow-2); }

.card-row__media {
    position: relative;
    width: 30%;
    max-width: 116px;
    flex-shrink: 0;
    background: var(--surface-2);
    overflow: hidden;
}

.card-row__media img { width: 100%; height: 100%; object-fit: cover; filter: var(--image-filter); }

.card-row__media--empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--fg-tertiary); }

.card-row__unavailable {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, .55);
    color: var(--fg-primary);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: flex; align-items: center; justify-content: center;
}

.card-row__body { flex: 1; min-width: 0; padding: var(--sp3) var(--sp4) var(--sp3) 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }

.card-row__name {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 17px;
    color: var(--fg-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-row__desc {
    font-size: 12.5px;
    color: var(--fg-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-row__price-row { display: flex; align-items: center; gap: var(--sp2); margin-top: 4px; }
.card-row__price { font-size: 19px; font-weight: 700; color: var(--fg-primary); }
.card-row__price-original { font-size: 13px; color: var(--fg-tertiary); text-decoration: line-through; }

/* Search-driven states (js/main.js toggles these) */
.card-row.is-hidden-by-search { display: none; }
.category-panel.is-dimmed-by-search { opacity: .32; }
.drawer__item.is-dimmed-by-search { opacity: .32; }
mark.search-highlight { background: var(--fg-primary); color: var(--bg); padding: 0 2px; }

/* ── Tags & badges ──────────────────────────────────────────────────────── */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-pill);
    color: var(--fg-tertiary);
}

.tag--offer { background: var(--fg-primary); color: var(--bg); border-color: var(--fg-primary); font-weight: 700; }

/* ── CTA button ─────────────────────────────────────────────────────────── */
.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp2);
    padding: var(--sp4) var(--sp6);
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--fg-primary);
    color: var(--bg);
    border-radius: var(--radius-md);
    transition: transform var(--dur-fast) var(--ease-brand), opacity var(--dur-fast) var(--ease-brand);
}

.cta-button:hover { transform: translateY(-1px); opacity: .92; box-shadow: var(--shadow-1); }
.cta-button--full { width: 100%; }

/* Bigger, brutalist footer CTA — a plain 14px button read as an
   afterthought at the bottom of the page. */
.cta-button--footer {
    display: flex;
    width: fit-content;
    padding: var(--sp4) var(--sp7);
    font-family: var(--font-display);
    font-size: 20px;
    letter-spacing: 0.02em;
}

.cta-button--ghost {
    background: transparent;
    color: var(--fg-primary);
    border: 1px solid var(--line-strong);
}

/* ── 2x2 card grid — home "Destacados"/"Eventos" sections ─────────────── */
.cards-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp4);
}

.cards-grid-2 .card-featured,
.cards-grid-2 .event-card { width: 100%; }

/* Desktop/tablet — a 3rd column plus a capped/centered row, instead of two
   cards stretching edge-to-edge on wide screens. Mobile stays the fixed
   2-up grid above, untouched. */
@media (min-width: 720px) {
    .cards-grid-2 {
        max-width: var(--container-max);
        margin-left: auto;
        margin-right: auto;
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── Product detail page ───────────────────────────────────────────────── */
.product-detail { max-width: 780px; margin: 0 auto; }

.product-detail__hero { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); border-bottom: 1px solid var(--line); }

@media (min-width: 720px) { .product-detail__hero { aspect-ratio: 21 / 9; } }

.product-detail__hero img { width: 100%; height: 100%; object-fit: cover; filter: var(--image-filter); }
.product-detail__hero-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--fg-tertiary); }
.product-detail__badge { position: absolute; bottom: var(--sp4); left: var(--sp5); }

.product-detail__content { padding: var(--sp6) var(--sp5) var(--sp7); }

.product-detail__category a { color: var(--fg-tertiary); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }

.product-detail__name { font-size: clamp(28px, 5.5vw, 42px); margin-top: var(--sp2); }

.product-detail__price-row { display: flex; align-items: baseline; gap: var(--sp3); margin-top: var(--sp4); }
.product-detail__price { font-size: clamp(28px, 6vw, 38px); font-weight: 700; color: var(--fg-primary); }
.product-detail__price-original { font-size: 16px; color: var(--fg-tertiary); text-decoration: line-through; }

.product-detail__desc { margin-top: var(--sp4); color: var(--fg-secondary); font-size: 14.5px; line-height: 1.65; }

.product-detail__unavailable { display: inline-block; margin-top: var(--sp4); }

.product-detail__back-icon { width: 18px; height: 18px; transform: rotate(90deg); }

/*
 * A normal in-flow module, not a sticky footer bar — it sits right after
 * the product info and before "también te puede interesar" so both CTAs
 * are visible before the recommendations shelf, not chasing it at the very
 * bottom of the page.
 */
.product-detail__actionbar {
    display: flex;
    gap: var(--sp3);
    padding: var(--sp5);
    margin-top: var(--sp2);
    background: var(--surface-1);
    border-top: 1px solid var(--line);
    box-shadow: var(--shadow-1);
}

.product-detail__actionbar .cta-button { flex: 1; }
.product-detail__actionbar .cta-button--ghost { flex: 0 0 auto; }

/* ── Group/combo detail — "Incluye" member list ────────────────────────── */
.product-detail__section-title {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fg-primary);
    margin-top: var(--sp6);
    margin-bottom: var(--sp3);
}

.card-row-list { display: flex; flex-direction: column; gap: var(--sp3); }

.card-row--static { cursor: default; }
.card-row--static:hover { border-color: var(--line-subtle); box-shadow: var(--shadow-1); }

.card-row__qty { color: var(--fg-tertiary); font-weight: 700; }
.card-row__variant { font-weight: 400; color: var(--fg-tertiary); font-size: 13px; }

/* ── Back/home overlay chip — pinned over the hero on detail pages ──────── */
.detail-back-btn {
    position: absolute;
    top: var(--sp4);
    left: var(--sp4);
    z-index: 2;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 10, .55);
    backdrop-filter: blur(6px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: var(--radius-pill);
}

.detail-back-btn .icon { width: 20px; height: 20px; transform: rotate(90deg); }

/* Variant pills */
.variant-pills { display: flex; flex-wrap: wrap; gap: var(--sp2); margin-top: var(--sp6); }

.variant-pill {
    padding: var(--sp2) var(--sp4);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--fg-secondary);
    font-size: 13px;
    transition: background-color var(--dur-fast) var(--ease-brand), color var(--dur-fast) var(--ease-brand);
}

.variant-pill.is-active { background: var(--fg-primary); color: var(--bg); border-color: var(--fg-primary); font-weight: 700; }

/* Modifiers */
.modifier-group { margin-top: var(--sp6); }

.modifier-group__head { display: flex; align-items: center; gap: var(--sp3); margin-bottom: var(--sp3); }
.modifier-group__head h3 { font-family: var(--font-body); font-weight: 700; font-size: 14px; color: var(--fg-primary); text-transform: none; }

.modifier-row {
    display: flex;
    align-items: center;
    gap: var(--sp3);
    padding: var(--sp3) 0;
    border-bottom: 1px solid var(--line-subtle);
    cursor: pointer;
}

.modifier-row__name { flex: 1; color: var(--fg-secondary); font-size: 14px; }
.modifier-row__price { color: var(--fg-tertiary); font-size: 12.5px; }

.modifier-row input[type="checkbox"],
.modifier-row input[type="radio"] {
    width: 18px; height: 18px;
    accent-color: var(--fg-primary);
}

/*
 * Elevated surface (surface-1, brushed-metal grain from materials.css) so
 * it reads as its own distinct module — otherwise it and the site footer
 * right below it were both near-black/near-bg-alt and blurred into one
 * continuous block with no visible seam.
 */
.product-detail__related {
    padding: var(--sp8) 0 var(--sp8);
    border-top: 1px solid var(--line-subtle);
    margin-top: var(--sp7);
    background: var(--surface-1);
}
/*
 * No negative-margin bleed here: .product-detail__related has zero side
 * padding of its own, so a negative margin on .shelf had nothing to
 * compensate against — it just pushed the shelf past the viewport edge
 * and caused page-level horizontal scroll. Padding alone gives the shelf
 * its gutter without breaking out of the container.
 */
.product-detail__related .shelf { padding: 0 var(--sp6) var(--sp4); gap: var(--sp5); }
.product-detail__related .section-header { padding: 0 var(--sp6); margin-bottom: var(--sp6); }

/* ── Breadcrumbs ────────────────────────────────────────────────────────── */
.breadcrumbs {
    max-width: 1080px;
    margin: 0 auto;
    padding: var(--sp3) var(--sp5);
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp2);
    font-size: 12px;
    color: var(--fg-tertiary);
}

.breadcrumbs a { color: var(--fg-tertiary); }
.breadcrumbs a:hover { color: var(--fg-primary); }
.breadcrumbs__sep { color: var(--line-strong); }
.breadcrumbs__current { color: var(--fg-secondary); }

/* ── Pagination ─────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    gap: var(--sp2);
    padding: var(--sp7) var(--sp4);
}

.pagination__link {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--sp2);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--fg-secondary);
    font-family: var(--font-mono);
    font-size: 13px;
}

.pagination__link.is-active { background: var(--fg-primary); color: var(--bg); border-color: var(--fg-primary); }
.pagination__link.is-disabled { opacity: .3; pointer-events: none; }

/* ── Floating WhatsApp button ───────────────────────────────────────────── */
.floating-whatsapp {
    position: fixed;
    right: var(--sp4);
    /* Clears the fixed bottom nav on mobile — see body:has() rule in
       layout.css that reserves this same height as page padding. */
    bottom: calc(var(--bottom-nav-height) + var(--sp3));
    z-index: 40;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--fg-primary);
    color: var(--bg);
    box-shadow: var(--shadow-elevation);
}

.floating-whatsapp .icon { width: 26px; height: 26px; }

@media (min-width: 900px) {
    /* Bottom nav is hidden at this width (layout.css) — no need to clear it. */
    .floating-whatsapp { bottom: var(--sp4); }
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty-state { padding: var(--sp9) var(--sp5); text-align: center; color: var(--fg-tertiary); }
.empty-state h2 { color: var(--fg-primary); margin-bottom: var(--sp3); }
.empty-state__icon { width: 40px; height: 40px; margin-bottom: var(--sp3); color: var(--fg-tertiary); }
