@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES (Single :root block — no duplicates)
   ============================================================ */
:root {
    /* Brand Colours */
    --primary:       #1e73be;
    --primary-dark:  #155a96;
    --secondary:     #C05530;
    --success:       #627D47;
    --alert:         #b20000;
    --text-dark:     #3c3c3c;
    --text-muted:    #777777;
    --bg-light:      #f7f7f7;
    --border-color:  #ececec;
    --instagram:     linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    /* iOS/Android Safe Area */
    --sat: env(safe-area-inset-top,    0px);
    --sar: env(safe-area-inset-right,  0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left,   0px);
}

/* ============================================================
   BASE
   ============================================================ */
body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    /* Prevent 300ms double-tap delay on mobile */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.font-serif {
    font-family: 'Playfair Display', serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ============================================================
   GLASS / CARDS
   ============================================================ */
.glass {
    background: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

/* ============================================================
   PRODUCT CARDS
   ============================================================ */
.product-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}

.product-image-container {
    background: #ffffff;
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    padding: 12px;
}

.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
    /* Prevent layout shift while image loads */
    display: block;
}

.product-card:hover .product-image-container img {
    transform: scale(1.18);
}
.product-card-set:hover .product-image-container img {
    transform: scale(1.35);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge-new, .badge-sale, .badge-kargo {
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 2px;
    text-transform: uppercase;
    line-height: 1.4;
}
.badge-new   { background-color: var(--success); }
.badge-sale  { background-color: var(--secondary); }
.badge-kargo { background-color: var(--primary); }

/* ============================================================
   HEADER & NAV
   ============================================================ */
header {
    background: #ffffff;
    border-bottom: 2px solid var(--primary);
}

.top-bar {
    background: #334862;
    color: #ffffff;
    font-size: 11px;
}

.nav-bottom {
    background: var(--primary);
    color: #ffffff;
}

.nav-link-bottom {
    color: #ffffff;
    font-weight: 600;
    letter-spacing: 0.05em;
    transition: background 0.25s ease;
    position: relative;
}

.nav-link-bottom:hover {
    background: var(--primary-dark);
}

/* Active nav indicator */
.nav-link-bottom.active {
    background: var(--primary-dark);
}
.nav-link-bottom.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px 2px 0 0;
}

/* ============================================================
   SEARCH DROPDOWN
   ============================================================ */
#search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 1100;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 0 0 4px 4px;
}

.suggestion-item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    /* Minimum 44px tap target */
    min-height: 44px;
}

.suggestion-item:hover {
    background: var(--bg-light);
}

/* ============================================================
   TRUST BADGES
   ============================================================ */
.trust-badge-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 24px;
    text-align: center;
    border-radius: 4px;
}

.trust-badge-card img {
    height: 48px;
    margin: 0 auto 16px auto;
}

/* ============================================================
   STARS
   ============================================================ */
.stars {
    color: #ffb703;
    display: inline-flex;
    gap: 2px;
}

/* ============================================================
   CART SIDEBAR
   ============================================================ */
#order-sidebar {
    background: #ffffff;
    color: var(--text-dark);
    /* Progressive enhancement: 100vh fallback, then 100dvh */
    height: 100vh;
    height: 100dvh;
}

#order-sidebar h3 {
    color: var(--primary);
}

/* iOS home-indicator safe area */
#order-sidebar > div:last-child {
    padding-bottom: calc(24px + var(--sab));
}

.order-item-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* ============================================================
   AGE GATE
   ============================================================ */
#age-gate {
    background: rgba(255, 255, 255, 0.98);
    color: var(--text-dark);
}

#age-gate .glass {
    border-color: var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   MOBILE MENU
   ============================================================ */
#mobile-menu {
    /* Progressive enhancement */
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    padding-bottom: calc(20px + var(--sab));
    /* Ensure menu is always visually ABOVE header on open */
    z-index: 950;
}

/* Body scroll-lock when mobile menu is open.
   On iOS Safari, overflow:hidden alone doesn't prevent scroll —
   position:fixed + width:100% is required. */
body.mobile-menu-open,
body.sidebar-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    /* Preserve scroll position visually */
    top: var(--scroll-y, 0);
}

/* ============================================================
   FLOATING ACTION BUTTONS (Instagram, WhatsApp, Cart)
   ============================================================ */
.wa-float {
    background: #25D366;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    /* Min 44px tap target */
    min-width: 48px;
    min-height: 48px;
}

.insta-float {
    background: var(--instagram);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(220, 39, 67, 0.4);
    min-width: 48px;
    min-height: 48px;
}

/* ============================================================
   INSTAGRAM / WHATSAPP EMBLEM UTILITIES
   ============================================================ */
.insta-emblem {
    background: var(--instagram);
    color: white !important;
    border-radius: 4px;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.insta-text {
    background: var(--instagram);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: bold;
}

.wa-emblem {
    background: #25D366;
    color: white !important;
    border-radius: 4px;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   SHIPPING PROGRESS BAR
   ============================================================ */
.shipping-progress-bg {
    background-color: #e2e8f0;
    border-radius: 9999px;
    height: 6px;
    width: 100%;
    overflow: hidden;
}

.shipping-progress-bar {
    height: 100%;
    background-color: var(--success);
    border-radius: 9999px;
    transition: width 0.4s ease;
    width: 0%;
}

/* Scroll Progress (disabled) */
#scroll-progress { display: none !important; }

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ============================================================
   iOS MOMENTUM SCROLL FOR OVERFLOW CONTAINERS
   ============================================================ */
#order-items,
#mobile-search-suggestions,
#search-suggestions {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ============================================================
   MOBILE UI — max-width: 767px (< md breakpoint)
   ============================================================ */
@media (max-width: 767px) {

    /* --- Top Bar --- */
    .top-bar {
        font-size: 10px;
        padding-left: 12px;
        padding-right: 12px;
        white-space: nowrap;
        overflow: hidden;
    }

    /* --- Header logo: fixed height (Tailwind h-14 = 3.5rem = 56px) --- */
    header .logo-img {
        height: 52px;
        width: auto;
        object-fit: contain;
    }

    /* --- Cart Sidebar: full-width on mobile --- */
    #order-sidebar {
        width: 100% !important;
    }

    /* --- Floating Buttons: safe-area-aware positions --- */
    /* Cart FAB */
    button.fab-cart {
        bottom: calc(14px + var(--sab));
        right: 14px;
    }

    /* WhatsApp FAB */
    .wa-float {
        bottom: calc(74px + var(--sab));
        right: 14px;
    }

    /* Instagram FAB */
    .insta-float {
        bottom: calc(134px + var(--sab));
        right: 14px;
    }

    /* --- Footer extra padding so FABs don't cover text --- */
    footer {
        padding-bottom: calc(110px + var(--sab));
    }

    /* --- Age Gate: better spacing on small screens --- */
    #age-gate > div {
        padding: 28px 20px !important;
        margin: 12px;
        max-width: calc(100vw - 24px);
    }

    #age-gate img {
        height: 80px !important;
        margin-bottom: 16px;
    }
}

/* ============================================================
   SMALL MOBILE — max-width: 479px (very small phones)
   ============================================================ */
@media (max-width: 479px) {

    /* Product card: tighter internals on narrow grids */
    .product-card > div:last-child {
        padding: 8px;
    }

    /* Add-to-cart: full-height tap target */
    .product-card button[data-action="add-to-cart"] {
        padding-top: 10px;
        padding-bottom: 10px;
        font-size: 9px;
        letter-spacing: 0.04em;
    }

    /* Product name: prevent overflow */
    .product-card h4 {
        font-size: 11px;
        min-height: 28px;
    }

    /* Product image: slightly less padding on tiny screen */
    .product-image-container {
        padding: 8px;
    }

    /* Section title on small screens */
    #products h2 {
        font-size: 1.6rem;
    }
}
