/* ==========================================================================
   Shell — header, bottom tab nav, sticky basket bar, footer, cookie banner.
   One responsive shell: header nav ≥768px, app-style bottom nav <768px.
   ========================================================================== */

@layer shell {

/* ── Header ────────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: rgba(255, 250, 246, 0.86);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(236, 231, 226, 0.9);
    height: var(--header-height);
    transition: box-shadow var(--transition);
}

.site-header.scrolled {
    box-shadow: 0 12px 30px rgba(23, 19, 15, 0.08);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    width: min(100%, var(--content-width));
    margin-inline: auto;
    padding-inline: var(--space-6);
    gap: var(--space-4);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    min-width: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--text);
    min-width: 0;
}

.logo img,
.logo-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--ink);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
    object-fit: cover;
    flex-shrink: 0;
}

.logo-mark i {
    font-size: 1.35rem;
}

.logo-text {
    line-height: 1.05;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logo-text small {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}

.main-nav a {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-secondary);
    padding: 0.25rem 0;
    transition: color var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--brand);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.header-icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-warm);
    box-shadow: var(--shadow-sm);
    color: var(--text-secondary);
    transition: all var(--transition);
}

.header-icon-btn:hover {
    color: var(--text);
    border-color: var(--gray-300);
}

.header-icon-btn i {
    font-size: 1.35rem;
}

.cart-badge-desktop,
.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--brand);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--surface);
}

.cart-badge-desktop[hidden] {
    display: none !important;
}

/* Below the shell switch: compact header, no inline nav */
@media (max-width: 767px) {
    .main-nav {
        display: none;
    }

    .header-inner {
        padding-inline: var(--space-4);
    }

    .logo img,
    .logo-mark {
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }

    .logo {
        font-size: 1.05rem;
    }

    .header-right .btn-account,
    .header-right .btn-order {
        display: none;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .header-left {
        gap: 1.5rem;
    }

    .main-nav {
        gap: 1.1rem;
    }

    .header-right .btn-order {
        display: none;
    }
}

/* ── Mobile hamburger menu (off-canvas, phones only) ───────────────── */
.mobile-menu-btn {
    display: none;
}

@media (max-width: 767px) {
    .mobile-menu-btn {
        display: flex;
    }
}

.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(23, 19, 15, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--z-drawer);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(340px, 88vw);
    background: var(--surface);
    z-index: calc(var(--z-drawer) + 1);
    transform: translateX(-100%);
    transition: transform 0.35s var(--ease-out-quart);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
}

.mobile-menu-overlay.active .mobile-menu {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.mobile-menu-title {
    font-weight: 900;
    font-size: var(--text-md);
    text-transform: uppercase;
}

.mobile-menu-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4) var(--space-4) var(--space-6);
}

.mobile-menu-section {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-light);
}

.mobile-menu-section:last-child {
    border-bottom: none;
}

.mobile-menu-label {
    font-size: var(--text-xs);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
}

.mobile-menu-section a,
.mobile-menu-section button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.8rem 0.75rem;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: var(--text-base);
    color: var(--text);
    transition: background var(--transition);
    text-align: left;
}

.mobile-menu-section a:hover,
.mobile-menu-section a:active,
.mobile-menu-section button:hover,
.mobile-menu-section button:active {
    background: var(--brand-light);
    color: var(--brand);
}

.mobile-menu-section i {
    font-size: 1.25rem;
    color: var(--brand);
    flex-shrink: 0;
}

.mobile-menu-newsletter-copy {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: 0 0.75rem 0.6rem;
}

.mobile-menu-newsletter {
    display: flex;
    gap: 0.5rem;
    padding: 0 0.75rem;
}

.mobile-menu-newsletter input {
    flex: 1;
    min-width: 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: var(--text-sm);
}

.mobile-menu-newsletter input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15);
}

.mobile-menu-newsletter button {
    width: auto;
    padding: 0.65rem 1rem;
    background: var(--brand);
    color: #fff;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: var(--text-sm);
    white-space: nowrap;
    flex-shrink: 0;
}

.mobile-menu-newsletter button:hover,
.mobile-menu-newsletter button:active {
    background: var(--brand-hover);
    color: #fff;
}

.mobile-menu-newsletter-feedback {
    padding: 0 0.75rem;
    font-size: var(--text-sm);
}

.mobile-menu-footer {
    padding: var(--space-4) var(--space-6) calc(var(--space-4) + var(--safe-bottom));
    border-top: 1px solid var(--border-light);
    font-size: var(--text-xs);
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ── Bottom tab nav (phones only) ──────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 250, 246, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -10px 30px rgba(23, 19, 15, 0.08);
    display: flex;
    justify-content: space-around;
    padding: 6px 0 calc(6px + var(--safe-bottom));
    z-index: var(--z-header);
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 14px;
    min-width: 64px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    transition: color var(--transition);
    position: relative;
    border-radius: var(--radius);
}

.bottom-nav .nav-item i {
    font-size: 1.45rem;
}

.bottom-nav .nav-item.active {
    color: var(--brand);
}

.bottom-nav .nav-item .cart-badge {
    top: 0;
    right: 8px;
}

/* ── Sticky basket bar ─────────────────────────────────────────────── */
.sticky-cart-bar {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translate(-50%, 140%);
    width: min(720px, calc(100% - 32px));
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 12px 14px 12px 18px;
    background: rgba(23, 19, 15, 0.92);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-full);
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.35s var(--ease-out-quart), opacity 0.25s ease, visibility 0.25s ease;
}

.sticky-cart-bar.visible {
    transform: translate(-50%, 0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

@media (max-width: 767px) {
    .sticky-cart-bar {
        bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 12px);
        justify-content: space-between;
    }
}

.sticky-cart-bar-count {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: var(--text-sm);
    font-weight: 800;
    color: #fff;
}

.sticky-cart-bar-count i {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand);
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 10px 26px rgba(255, 107, 53, 0.35);
}

.sticky-cart-bar-total {
    font-size: var(--text-md);
    font-weight: 800;
    color: rgba(255, 255, 255, 0.75);
    margin-left: auto;
}

.sticky-cart-bar-checkout {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 1.2rem;
    background: #fff;
    color: var(--ink);
    font-weight: 900;
    font-size: var(--text-sm);
    border-radius: var(--radius-full);
    transition: all var(--transition);
    white-space: nowrap;
}

.sticky-cart-bar-checkout:hover {
    background: var(--orange-50);
}

/* ── Scroll to top ─────────────────────────────────────────────────── */
.scroll-to-top {
    position: fixed;
    right: 22px;
    bottom: 92px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    box-shadow: var(--shadow-brand);
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(18px);
    transition: opacity var(--transition), visibility var(--transition), transform var(--transition), background var(--transition);
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background: var(--brand-hover);
}

@media (max-width: 767px) {
    .scroll-to-top {
        right: 16px;
        bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 84px);
        width: 44px;
        height: 44px;
    }
}

/* ── Messages strip (Django messages) ──────────────────────────────── */
.messages-strip {
    width: min(100%, var(--content-width));
    margin-inline: auto;
    padding: var(--space-4) var(--space-6) 0;
}

@media (max-width: 767px) {
    .messages-strip {
        padding-inline: var(--space-4);
    }
}

/* ── Footer ────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--ink);
    color: rgba(255, 255, 255, 0.7);
    margin-top: auto;
}

/* App shell on phones: the bottom nav and hamburger menu carry all
   footer links, so the footer itself is desktop/tablet only. */
@media (max-width: 767px) {
    .site-footer {
        display: none;
    }
}

.footer-main {
    width: min(100%, var(--content-width));
    margin-inline: auto;
    padding: var(--space-16) var(--space-6);
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-12);
}

@media (max-width: 1023px) {
    .footer-main {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-8);
    }
}

@media (max-width: 640px) {
    .footer-main {
        grid-template-columns: 1fr;
        padding: var(--space-10) var(--space-4);
    }
}

.footer-brand p {
    margin-top: 1rem;
    font-size: var(--text-sm);
    line-height: 1.7;
    max-width: 300px;
    color: rgba(255, 255, 255, 0.6);
}

.footer-brand .logo {
    color: #fff;
    text-transform: uppercase;
}

.footer-col h4 {
    color: #fff;
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1.25rem;
}

.footer-col a,
.footer-col button {
    display: block;
    padding: 0.35rem 0;
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.65);
    transition: color var(--transition);
    text-align: left;
}

.footer-col a:hover,
.footer-col button:hover {
    color: #fff;
}

.footer-newsletter {
    padding-top: 1.25rem;
}

.footer-newsletter p {
    font-size: var(--text-sm);
    margin-bottom: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.footer-newsletter-form {
    display: flex;
    gap: 0.5rem;
}

.footer-newsletter-form input {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: var(--text-sm);
}

.footer-newsletter-form input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.footer-newsletter-form input:focus {
    outline: none;
    border-color: var(--brand);
    background: rgba(255, 255, 255, 0.15);
}

.footer-newsletter-form button {
    padding: 0.6rem 1rem;
    background: var(--brand);
    color: #fff;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: var(--text-sm);
    transition: background var(--transition);
    white-space: nowrap;
}

.footer-newsletter-form button:hover {
    background: var(--brand-hover);
}

.footer-trust {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-trust-badges {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.footer-trust-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.6);
}

.footer-trust-badge i {
    font-size: 1.1rem;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem var(--space-6);
}

.footer-bottom-inner {
    width: min(100%, var(--content-width));
    margin-inline: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: var(--text-xs);
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.footer-social a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.footer-social a:hover {
    background: var(--brand);
    color: #fff;
}

/* ── Cookie consent banner ─────────────────────────────────────────── */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-banner);
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    /* The banner sits above the bottom tab bar on phones, so a pure
       translateY(105%) would leave its top edge peeking over the nav.
       Hide it outright when it isn't active. */
    transform: translateY(105%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.4s var(--ease-out-quart), opacity 0.3s ease, visibility 0.3s ease;
    padding: 1.25rem 2rem;
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
}

.cookie-consent-banner.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

@media (max-width: 767px) {
    .cookie-consent-banner {
        bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
        padding: 1rem 1.25rem;
        border-radius: 20px 20px 0 0;
        max-height: calc(100vh - var(--header-height) - var(--bottom-nav-height) - var(--safe-bottom));
    }
}

.cookie-consent-content {
    max-width: var(--content-width);
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.cookie-consent-text h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.cookie-consent-text p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.cookie-consent-text a {
    color: var(--brand);
    text-decoration: underline;
}

.cookie-consent-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .cookie-consent-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .cookie-consent-actions .cookie-btn {
        flex: 1;
    }
}

.cookie-btn {
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: var(--text-sm);
    transition: all var(--transition);
    white-space: nowrap;
}

.cookie-btn-accept {
    background: var(--brand);
    color: #fff;
}

.cookie-btn-accept:hover {
    background: var(--brand-hover);
}

.cookie-btn-essential {
    background: var(--gray-100);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.cookie-btn-essential:hover {
    background: var(--gray-200);
}

} /* end @layer shell */
