/* Mobile app shell — bottom tabs, compact header, app-like sheets */
:root {
    --tabbar-h: 64px;
    --app-header-h: 58px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 767px) {
    html { -webkit-text-size-adjust: 100%; }
    body {
        -webkit-tap-highlight-color: transparent;
        overscroll-behavior-y: none;
    }

    :root {
        --nav-h: var(--app-header-h);
    }

    .body-wrapper {
        padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
    }

    /* Compact app header */
    .navbar-section {
        border-bottom: none;
        box-shadow: 0 1px 0 rgba(63, 32, 22, 0.08);
        padding-top: var(--safe-top);
    }
    .navbar-inner {
        width: 100%;
        padding: 10px 16px;
        gap: 12px;
    }
    .navbar-wordmark { font-size: 1.25rem; letter-spacing: 0.14em; }
    .nav-actions { gap: 8px; }
    .nav-actions .hamburger { display: none; }
    .nav-actions .lang-chip { display: none; }
    .nav-actions .nav-link-primary { display: none; }

    .app-header-cart {
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        width: 42px;
        height: 42px;
        border: none;
        border-radius: 12px;
        background: var(--fi-brown);
        color: #fff;
        font-size: 1.1rem;
        cursor: pointer;
    }
    .app-header-cart .nav-cart-count {
        position: absolute;
        top: -4px;
        right: -4px;
        margin: 0;
        min-width: 18px;
        height: 18px;
        border: 2px solid var(--fi-cream);
    }

    /* Bottom tab bar */
    .app-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1600;
        display: flex;
        align-items: flex-end;
        justify-content: space-around;
        height: calc(var(--tabbar-h) + var(--safe-bottom));
        padding: 6px 8px calc(6px + var(--safe-bottom));
        background: #fff;
        border-top: 1px solid rgba(63, 32, 22, 0.1);
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.08);
    }

    .app-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 48px;
        padding: 4px 2px;
        border: none;
        background: transparent;
        color: #8a7a72;
        font-size: 0.58rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        text-decoration: none;
        cursor: pointer;
        position: relative;
        -webkit-user-select: none;
        user-select: none;
    }
    .app-tab i { font-size: 1.25rem; line-height: 1; }
    .app-tab.is-active { color: var(--fi-orange); }
    .app-tab:active { transform: scale(0.96); }

    .app-tab-order {
        flex: 0 0 auto;
        margin-top: -22px;
        color: var(--fi-brown);
    }
    .app-tab-order-inner {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 54px;
        height: 54px;
        border-radius: 50%;
        background: linear-gradient(145deg, var(--fi-orange), #e04400);
        color: #fff;
        font-size: 1.35rem;
        box-shadow: 0 8px 24px rgba(252, 80, 7, 0.45);
        border: 4px solid #fff;
    }
    .app-tab-order .app-tab-badge {
        top: -2px;
        right: 8px;
    }

    .app-tab-badge,
    .nav-cart-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        border-radius: 999px;
        background: var(--fi-orange);
        color: #fff;
        font-size: 0.62rem;
        font-weight: 800;
    }
    .app-tab-badge:empty,
    .app-tab-badge[data-count="0"] { display: none; }

    /* Cart strip above tab bar */
    .app-cart-strip {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px);
        z-index: 1550;
        transform: translateY(120%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.35s ease, opacity 0.35s ease;
    }
    .app-cart-strip.visible {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
    .app-cart-strip-btn {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 14px 18px;
        border: none;
        border-radius: 16px;
        background: var(--fi-brown);
        color: #fff;
        font-size: 0.82rem;
        font-weight: 600;
        cursor: pointer;
        box-shadow: 0 8px 28px rgba(63, 32, 22, 0.35);
    }
    .app-cart-strip-btn strong {
        color: var(--fi-gold);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Hide floating WhatsApp — use Order tab + cart checkout */
    .whatsapp-float { display: none !important; }

    /* Mobile nav as bottom sheet */
    .navbar-overlay {
        top: auto;
        bottom: 0;
        height: min(88vh, 640px);
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        padding: 24px 24px calc(24px + var(--safe-bottom));
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.2);
    }
    .navbar-overlay.open { transform: translateY(0); }
    .fi-nav-header { margin-bottom: 24px; }
    .fi-nav-primary a { font-size: 1.1rem; padding: 12px 0; }

    /* Footer — compact app style */
    .fi-footer { padding: 32px 0 calc(24px + var(--safe-bottom)); }
    .fi-footer-grid > div:not(:first-child) { display: none; }
    .fi-footer-grid > div:first-child p { font-size: 0.82rem; }
    .fi-footer-searches { display: none; }
    .fi-footer-bottom {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        font-size: 0.72rem;
    }

    /* Hero — video banner */
    .fi-hero--video {
        margin-top: calc(var(--nav-h) * -1);
    }
    .fi-hero-video-wrap {
        height: clamp(360px, 78svh, 720px);
        min-height: 360px;
    }

    /* Sections — tighter spacing */
    .fi-wrap, .container { width: calc(100% - 24px); }
    .fi-intro, .fi-occasions, .fi-anchor, .fi-space, .fi-global,
    .fi-seasonal, .fi-stories, .fi-rewards, .fi-cta, .fi-geo {
        padding-top: 40px;
        padding-bottom: 40px;
    }

    /* Horizontal product strips — snap scrolling */
    .fi-occ-strip, .fi-space-track {
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
        scroll-padding-left: 12px;
    }
    .fi-occ-card { flex: 0 0 148px; }

    /* Menu page app layout */
    .fm-menu-page { padding-bottom: 24px; }
    .fm-nav { top: var(--nav-h); }
    .fm-nav-scroll {
        padding: 10px 12px;
        margin: 0 -12px;
        padding-left: 12px;
    }
    .fm-h1 { margin-top: 12px; }
    .fm-search-bar { margin-top: 12px; }
    .fm-search-bar input { min-height: 46px; font-size: 16px; }
    .fm-section { padding: 20px 0 8px; scroll-margin-top: calc(var(--nav-h) + 52px); }
    .fm-items { gap: 12px; }

    /* App-style menu cards */
    .fm-card {
        border-radius: 18px;
        box-shadow: 0 2px 12px rgba(63, 32, 22, 0.06);
    }
    .fm-card-top { padding: 12px 14px; }
    .fm-card-thumb { display: none; }
    .fm-card-info h3 { font-size: 0.92rem; }
    .fm-card-price { font-size: 0.82rem; color: var(--fi-orange); font-weight: 800; }
    .fm-card-desc-preview { -webkit-line-clamp: 1; }
    .fm-card-hero { aspect-ratio: 16/11; }
    .fm-card.expanded .fm-quick-add { display: none; }

    /* Cookie banner above tab bar */
    .cookie-banner {
        bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
    }

    /* Toast above tab bar */
    .cart-toast {
        bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
    }
}

@media (min-width: 768px) {
    .app-tabbar,
    .app-cart-strip,
    .app-header-cart { display: none !important; }
}
