/*
 * COMPONENT: Header (Floating Glass Pill - Final)
 */

.site-header {
    position: fixed;
    /* STICKY FIX */
    top: 20px;
    left: 0;
    width: 100%;
    z-index: 1000;
    height: auto;
    background: transparent;
    border: none;
    padding: 0 16px;
    pointer-events: none;
    /* Pass clicks through outside pill */
    transition: top 0.3s ease;
}

/* THE PILL CONTAINER */
.header-pill-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    /* Optimal reading width for pill */
    margin: 0 auto;

    /* Premium Glass Effect */
    background: rgba(40, 40, 40, 0.4);
    /* Darker transparent base for contrast */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    /* Subtle rim */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    /* Deep shadow */

    border-radius: 999px;
    /* Full Pill */
    padding: 10px 32px;
    height: 72px;
    /* Substantial height */
    pointer-events: auto;
    /* Re-enable clicks */
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* LEFT: LOGO */
.header-left {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.brand-logo {
    font-family: 'Playfair Display', serif;
    /* Premium Serif */
    font-size: 1.75rem;
    color: #ffffff;
    text-decoration: none;
    line-height: 1;
    position: relative;
    top: -2px;
    /* Optical adjustment */
}

/* CENTER: NAV */
.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.header-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 40px;
}

.header-nav-list li a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.9375rem;
    /* 15px */
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color 0.2s;
    font-family: 'Inter', sans-serif;
    /* Clean Sans for Nav */
}

.header-nav-list li a:hover {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* RIGHT: ICONS */
.header-right {
    flex: 0 0 auto;
    display: flex;
    gap: 12px;
}

.header-icon {
    width: 44px;
    height: 44px;
    position: relative;
    /* Anchor for dot */
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    /* Subtle circle */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.header-icon:hover {
    background: #ffffff;
    color: #000000;
    /* Invert */
    transform: translateY(-1px);
}

.cart-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: #FFD700;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(40, 40, 40, 0.8);
    /* Optional contrast ring */
}

.mobile-menu-toggle {
    display: none;
}

/* ------------------------------------------------
   PWA APP HEADER (Sticky, Glass, Mobile Only)
------------------------------------------------ */
.pwa-header {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    padding-top: env(safe-area-inset-top);
    height: calc(60px + env(safe-area-inset-top));
}

.pwa-logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-ink-primary, #1a1a1a);
}

.pwa-icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--color-ink-primary, #1a1a1a);
    cursor: pointer;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .header-center.desktop-only {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
        /* Show on mobile */
        margin-right: auto;
        /* Push everything else to right? or use flex gap */
    }

    /* Since we want: [Toggle] [Logo] [Icons]
       and container is space-between.
       Toggle is first child. Logo second. Icons third.
       This works naturally with space-between if they are the only 3 children.
    */

    .header-pill-container {
        height: 60px;
        padding: 8px 16px;
        /* Ensure there's gap if space-between collapses */
        gap: 12px;
    }

    .brand-logo {
        font-size: 1.5rem;
        /* On mobile, user usually wants center logo. 
           With space-between: Toggle(L) Logo(Center?? No) Icons(R)
           To center Logo absolutely:
        */
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    .header-left {
        /* Remove its width influence if we absolute position the logo */
        position: static;
    }
}

/* Hide header in PWA standalone mode on mobile */
@media (max-width: 900px) {
    /* Standard PWA Check */
    @media (display-mode: standalone) {
        .site-header {
            display: none;
        }

        .pwa-header {
            display: flex;
        }
    }

    /* iOS Safari Standalone Check (via JS class) */
    html.standalone .site-header {
        display: none;
    }

    html.standalone .pwa-header {
        display: flex;
    }
}

/* ------------------------------------------------
   PWA SEARCH OVERLAY
   Simple, clean, full-width search input
------------------------------------------------ */
.pwa-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1100;
    /* Above PWA Header */
    background: #ffffff;
    padding: 0 16px;
    padding-top: env(safe-area-inset-top);
    height: calc(60px + env(safe-area-inset-top));
    display: flex;
    align-items: center;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.pwa-search-overlay.active {
    transform: translateY(0);
}

.pwa-search-form {
    width: 100%;
}

.pwa-search-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.pwa-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--color-ink-primary, #1a1a1a);
    padding: 8px 0;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.pwa-search-input::placeholder {
    color: var(--color-ink-tertiary, #999);
}

.pwa-search-submit,
.pwa-search-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--color-ink-secondary, #666);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-search-submit {
    padding-left: 0;
}

.pwa-search-close {
    padding-right: 0;
}