/* ==========================================================================
   COCO CANDLES — LUXURY CRAFT DESIGN SYSTEM & ARCHITECTURE
   Optimized for Instagram In-App Browser (iOS WKWebView & Android Chrome)
   WCAG 2.2 AA Accessible • Modern CSS Architecture (oklch, nesting, container queries)
   ========================================================================== */

:root {
    /* --- COLOR PALETTE (OKLCH Color Space) --- */
    --clr-bg: oklch(0.985 0.006 85);            /* Soft natural soy wax / linen */
    --clr-surface: oklch(1 0 0);                /* Pure white surface */
    --clr-surface-glass: oklch(1 0 0 / 0.86);
    --clr-text-main: oklch(0.24 0.018 45);       /* Deep roasted cocoa / obsidian warm */
    --clr-text-muted: oklch(0.50 0.015 50);      /* Warm slate taupe */
    --clr-primary: oklch(0.76 0.12 85);          /* Soft amber gold */
    --clr-primary-dark: oklch(0.62 0.13 78);     /* Antique burnished gold */
    --clr-accent: oklch(0.56 0.035 55);         /* Terracotta / artisanal taupe */
    --clr-border: oklch(0.24 0.018 45 / 0.08);   /* Subtle structural border */
    --clr-card-bg: oklch(0.99 0.003 85);

    /* --- FLUID TYPOGRAPHY (Scalable clamp() without rigid breakpoints) --- */
    --font-family: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-h1: clamp(2rem, 1.4rem + 2.5vw, 3.2rem);
    --font-h2: clamp(1.5rem, 1.2rem + 1.5vw, 2.2rem);
    --font-body: clamp(0.95rem, 0.9rem + 0.25vw, 1.1rem);
    --font-xs: clamp(0.78rem, 0.74rem + 0.15vw, 0.88rem);
    --font-sm: clamp(0.88rem, 0.84rem + 0.2vw, 0.98rem);
    --font-md: clamp(1rem, 0.96rem + 0.25vw, 1.15rem);
    --font-lg: clamp(1.25rem, 1.15rem + 0.4vw, 1.45rem);

    /* --- SPACING TOKENS --- */
    --space-xs: 0.35rem;
    --space-sm: 0.65rem;
    --space-md: 1.1rem;
    --space-lg: 1.6rem;
    --space-xl: 2.2rem;
    --space-2xl: 3.2rem;

    /* --- SHADOWS & GEOMETRY --- */
    --shadow-soft: 0 4px 20px oklch(0.24 0.018 45 / 0.06);
    --shadow-medium: 0 8px 30px oklch(0.24 0.018 45 / 0.10);
    --shadow-heavy: 0 16px 45px oklch(0.24 0.018 45 / 0.18);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    --radius-full: 9999px;
    --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- RESET & ACCESSIBILITY DEFAULTS --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-body);
    line-height: 1.6;
    background-color: var(--clr-bg);
    color: var(--clr-text-main);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: calc(100px + env(safe-area-inset-top));
    overflow-x: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

body::-webkit-scrollbar {
    display: none;
}

/* Anti-Zoom on iOS WebViews + Touch Optimization */
input,
select,
textarea,
button {
    font-family: inherit;
    font-size: 1rem; /* >= 16px to prevent automatic iOS zoom */
    touch-action: manipulation; /* Eliminate 300ms tap latency */
    border: none;
    background: none;
}

button,
a {
    cursor: pointer;
    touch-action: manipulation;
}

img,
picture {
    max-width: 100%;
    display: block;
    object-fit: cover;
}

ul {
    list-style: none;
}

/* Glassmorphism Utility */
.glass-effect {
    background: var(--clr-surface-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid oklch(1 0 0 / 0.4);
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* --- APP HEADER & ANNOUNCEMENT BAR --- */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);

    & .announcement-bar {
        width: 100%;
        background-color: var(--clr-text-main);
        color: var(--clr-surface);
        overflow: hidden;
        padding: 6px 0;
        white-space: nowrap;

        & .marquee-content {
            display: inline-block;
            white-space: nowrap;
            animation: marqueeScroll 18s linear infinite;

            & span {
                font-size: 12px;
                font-weight: 600;
                margin-right: 48px;
                display: inline-block;
            }
        }
    }

    & .header-inner {
        height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    & .logo {
        font-size: var(--font-h2);
        font-weight: 700;
        letter-spacing: -0.5px;
        color: var(--clr-text-main);

        & span {
            font-weight: 300;
            color: var(--clr-accent);
        }
    }
}

@keyframes marqueeScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* --- SECTION: HOW IT WORKS --- */
.how-it-works {
    margin-bottom: var(--space-xl);

    & .how-title {
        font-size: var(--font-xs);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        text-align: center;
        color: var(--clr-primary-dark);
        margin-bottom: var(--space-md);
    }

    & .steps-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-sm);
    }

    & .step-card {
        background: linear-gradient(135deg, oklch(0.98 0.01 80) 0%, oklch(0.95 0.02 75) 100%);
        border: 1px solid var(--clr-border);
        border-radius: var(--radius-lg);
        padding: var(--space-md) var(--space-xs);
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        position: relative;
        box-shadow: var(--shadow-soft);
        transition: transform 0.3s var(--transition-smooth), box-shadow 0.3s var(--transition-smooth);

        &:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-medium);
        }

        & .step-badge {
            position: absolute;
            top: -9px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--clr-text-main);
            color: var(--clr-surface);
            font-size: 11px;
            font-weight: 700;
            width: 22px;
            height: 22px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 2px 5px oklch(0 0 0 / 0.15);
        }

        & .step-icon {
            width: 42px;
            height: 42px;
            border-radius: 50%;
            background: oklch(1 0 0 / 0.9);
            color: var(--clr-primary-dark);
            display: flex;
            align-items: center;
            justify-content: center;
            margin-top: 4px;
            margin-bottom: var(--space-xs);
            box-shadow: 0 2px 8px oklch(0 0 0 / 0.04);
        }

        & h4 {
            font-size: var(--font-sm);
            font-weight: 700;
            color: var(--clr-text-main);
            margin-bottom: 2px;
        }

        & p {
            font-size: var(--font-xs);
            color: var(--clr-text-muted);
            line-height: 1.3;
        }
    }
}

/* --- SECTION: PRODUCTS & CONTAINER QUERIES --- */
.products {
    margin-bottom: var(--space-2xl);

    & .products-header {
        margin-bottom: var(--space-md);
        text-align: center;

        & h2 {
            font-size: var(--font-h2);
            font-weight: 700;
            color: var(--clr-text-main);
        }
    }
}

/* Category Filter Chips with minimum 48px touch targets */
.category-filters {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 6px var(--space-xs) var(--space-md);
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    justify-content: safe center;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;

    &::-webkit-scrollbar {
        display: none;
    }
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px; /* 48px Touch Target */
    padding: 0 20px;
    border-radius: var(--radius-full);
    background-color: var(--clr-card-bg);
    color: var(--clr-text-muted);
    font-size: var(--font-sm);
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--clr-border);
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.15s ease, border-color 0.25s ease;
    flex-shrink: 0;

    &:active {
        transform: scale(0.96);
    }

    &.active {
        background-color: var(--clr-text-main);
        color: var(--clr-surface);
        border-color: var(--clr-text-main);
        box-shadow: 0 3px 12px oklch(0.24 0.018 45 / 0.18);
    }
}

/* Product Grid & Container Queries */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.product-card-container {
    container-type: inline-size;
}

.product-card {
    background-color: var(--clr-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--clr-border);
    transition: box-shadow 0.3s var(--transition-smooth), transform 0.3s var(--transition-smooth);

    &:hover {
        box-shadow: var(--shadow-medium);
        transform: translateY(-2px);
    }

    & .product-image {
        position: relative;
        aspect-ratio: 1 / 1;
        overflow: hidden;
        background-color: oklch(0.96 0.005 85);
        cursor: pointer;

        & img {
            width: 100%;
            height: 100%;
            aspect-ratio: 1 / 1;
            transition: transform 0.5s var(--transition-smooth);
        }
    }

    &:active .product-image img {
        transform: scale(1.04);
    }

    & .product-info {
        padding: var(--space-md);
        display: flex;
        flex-direction: column;
        flex-grow: 1;
    }

    & .product-title {
        font-size: var(--font-sm);
        font-weight: 600;
        margin-bottom: var(--space-xs);
        text-align: center;
        color: var(--clr-text-main);
    }

    & .add-btn {
        min-height: 48px; /* 48px Touch Target */
        background-color: var(--clr-text-main);
        color: var(--clr-surface);
        padding: 0 var(--space-md);
        border-radius: var(--radius-md);
        font-size: var(--font-sm);
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        transition: background-color 0.25s ease, transform 0.2s ease;
        width: 100%;
        margin-top: auto;

        &:active {
            transform: scale(0.97);
            background-color: var(--clr-accent);
        }
    }
}

/* @container Adaptations */
@container (min-width: 280px) {
    .product-card .product-title {
        font-size: var(--font-md);
    }
}

/* --- SECTION: FAQ & WICK CARE (<details> & <summary>) --- */
.candle-guide {
    margin-top: var(--space-xl);
    margin-bottom: var(--space-2xl);

    & .section-title-wrap {
        text-align: center;
        margin-bottom: var(--space-lg);

        & .section-title {
            font-size: var(--font-h2);
            font-weight: 700;
            color: var(--clr-text-main);
        }

        & .section-subtitle {
            font-size: var(--font-sm);
            color: var(--clr-text-muted);
            margin-top: 4px;
        }
    }

    & .faq-accordion {
        display: flex;
        flex-direction: column;
        gap: var(--space-sm);
        max-width: 760px;
        margin: 0 auto;
    }

    & .faq-item {
        background-color: var(--clr-surface);
        border: 1px solid var(--clr-border);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-soft);
        overflow: hidden;
        transition: border-color 0.3s ease, box-shadow 0.3s ease;

        &[open] {
            border-color: var(--clr-primary-dark);
            box-shadow: var(--shadow-medium);

            & .faq-icon {
                transform: rotate(180deg);
                color: var(--clr-primary-dark);
            }
        }
    }

    & .faq-question {
        list-style: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--space-md);
        min-height: 48px; /* 48px Touch Target */
        font-size: var(--font-sm);
        font-weight: 600;
        color: var(--clr-text-main);
        cursor: pointer;
        user-select: none;
        touch-action: manipulation;

        &::-webkit-details-marker {
            display: none;
        }

        & .faq-icon {
            flex-shrink: 0;
            color: var(--clr-text-muted);
            transition: transform 0.3s var(--transition-smooth), color 0.3s ease;
        }
    }

    & .faq-answer {
        padding: 0 var(--space-md) var(--space-md);
        font-size: var(--font-sm);
        color: var(--clr-text-muted);
        line-height: 1.6;

        & strong {
            color: var(--clr-text-main);
        }
    }
}

/* --- SECTION: FEATURES / VALORI --- */
.features-section {
    margin-top: var(--space-xl);
    margin-bottom: var(--space-2xl);
    text-align: center;

    & .features-title {
        font-size: var(--font-h2);
        font-weight: 700;
        margin-bottom: var(--space-md);
    }

    & .features-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-sm);
    }

    & .feature-box {
        background-color: var(--clr-surface);
        padding: var(--space-md) var(--space-xs);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-soft);
        border: 1px solid var(--clr-border);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
        transition: transform 0.3s var(--transition-smooth), box-shadow 0.3s var(--transition-smooth);

        & .feature-icon {
            color: var(--clr-primary-dark);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        & span {
            font-size: var(--font-xs);
            font-weight: 600;
            color: var(--clr-text-main);
        }
    }
}

/* --- SECTION: INSTAGRAM COMMUNITY --- */
.instagram-box {
    margin-top: var(--space-xl);
    margin-bottom: var(--space-xl);

    & .instagram-card {
        background: linear-gradient(135deg, 
            oklch(0.95 0.08 65 / 0.18) 0%, 
            oklch(0.85 0.15 35 / 0.12) 40%, 
            oklch(0.70 0.18 330 / 0.12) 75%, 
            oklch(0.65 0.15 280 / 0.10) 100%), 
            var(--clr-surface);
        border: 1px solid oklch(0.70 0.18 330 / 0.2);
        border-radius: var(--radius-xl);
        padding: var(--space-xl) var(--space-md);
        text-align: center;
        box-shadow: var(--shadow-medium);
        display: flex;
        flex-direction: column;
        align-items: center;
        position: relative;
        overflow: hidden;
    }

    & .instagram-icon-wrapper {
        width: 60px;
        height: 60px;
        border-radius: 18px;
        background: var(--clr-surface);
        color: #D62976;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: var(--space-md);
        box-shadow: 0 6px 18px oklch(0.70 0.18 330 / 0.18);
        border: 1px solid oklch(0.70 0.18 330 / 0.15);
    }

    & .instagram-title {
        font-size: var(--font-lg);
        font-weight: 700;
        color: var(--clr-text-main);
        margin-bottom: var(--space-xs);
    }

    & .instagram-text {
        font-size: var(--font-sm);
        color: var(--clr-text-muted);
        line-height: 1.5;
        max-width: 400px;
        margin: 0 auto var(--space-lg);
    }

    & .instagram-btn {
        min-height: 48px; /* 48px Touch Target */
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        background-color: var(--clr-text-main);
        color: var(--clr-surface);
        padding: 0 24px;
        border-radius: var(--radius-full);
        font-size: var(--font-sm);
        font-weight: 600;
        text-decoration: none;
        box-shadow: 0 4px 16px oklch(0.24 0.018 45 / 0.18);
        transition: transform 0.25s ease, background-color 0.25s ease;

        &:hover {
            background-color: oklch(0.18 0.018 45);
            transform: translateY(-2px);
        }

        &:active {
            transform: scale(0.98);
        }
    }
}

/* --- FOOTER --- */
.app-footer {
    background-color: var(--clr-text-main);
    color: var(--clr-surface);
    margin-top: var(--space-2xl);
    padding-top: var(--space-xl);
    padding-bottom: calc(110px + env(safe-area-inset-bottom));
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);

    & .footer-links {
        text-align: center;
        margin-bottom: var(--space-md);
    }

    & .footer-link-btn {
        min-height: 48px; /* 48px Touch Target */
        padding: 0 16px;
        color: var(--clr-surface);
        text-decoration: underline;
        font-size: var(--font-sm);
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    & .copyright {
        text-align: center;
        font-size: 12px;
        color: oklch(1 0 0 / 0.55);
        margin-top: var(--space-md);
        border-top: 1px solid oklch(1 0 0 / 0.12);
        padding-top: var(--space-md);
    }
}

/* --- FLOATING BOTTOM DOCK --- */
.bottom-dock {
    position: fixed;
    bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2 * var(--space-md));
    max-width: 400px;
    height: 68px;
    background: oklch(1 0 0 / 0.92);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: space-around;
    box-shadow: var(--shadow-heavy);
    border: 1px solid oklch(1 0 0 / 0.6);
    z-index: 90;
    padding: 0 var(--space-sm);
}

.dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    min-height: 48px; /* 48px Touch Target */
    color: var(--clr-text-muted);
    transition: color 0.25s ease;
    gap: 3px;
    position: relative;

    &.active {
        color: var(--clr-text-main);
    }

    & span {
        font-size: 11px;
        font-weight: 600;
    }

    &:active svg {
        transform: scale(0.92);
    }
}

.dock-icon-wrapper {
    position: relative;
    display: flex;
}

.badge {
    position: absolute;
    top: -6px;
    right: -10px;
    background-color: var(--clr-text-main);
    color: var(--clr-surface);
    font-size: 11px;
    font-weight: 700;
    height: 19px;
    min-width: 19px;
    padding: 0 4px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 6px oklch(0.24 0.018 45 / 0.25);
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.3s var(--transition-smooth), transform 0.3s var(--transition-smooth);

    &.visible {
        opacity: 1;
        transform: scale(1);
    }

    &.pop {
        animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
}

@keyframes badgePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   NATIVE <dialog> BOTTOM SHEETS WITH @starting-style & DISCRETE TRANSITIONS
   ========================================================================== */

dialog.bottom-sheet-dialog {
    position: fixed;
    inset: auto 0 0 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-height: 380px;
    max-height: 90vh;
    max-height: 90dvh; /* Instagram Viewport Safe */
    background: var(--clr-surface);
    border: none;
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    padding: var(--space-lg) var(--space-md) calc(var(--space-md) + env(safe-area-inset-bottom));
    box-shadow: var(--shadow-heavy);
    display: none;
    pointer-events: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;

    /* Entry & Exit discrete transitions */
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.35s var(--transition-smooth),
                opacity 0.35s var(--transition-smooth),
                display 0.35s allow-discrete,
                overlay 0.35s allow-discrete;

    &[open] {
        display: flex;
        pointer-events: auto;
        transform: translateY(0);
        opacity: 1;
    }
}

@starting-style {
    dialog.bottom-sheet-dialog[open] {
        transform: translateY(100%);
        opacity: 0;
    }
}

dialog.bottom-sheet-dialog::backdrop {
    background-color: oklch(0 0 0 / 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: background-color 0.35s ease,
                backdrop-filter 0.35s ease,
                display 0.35s allow-discrete,
                overlay 0.35s allow-discrete;
}

dialog.bottom-sheet-dialog[open]::backdrop {
    background-color: oklch(0 0 0 / 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

@starting-style {
    dialog.bottom-sheet-dialog[open]::backdrop {
        background-color: oklch(0 0 0 / 0);
        backdrop-filter: blur(0px);
    }
}

/* Tablet & Desktop Dialog Placement */
@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    dialog.bottom-sheet-dialog {
        inset: auto 24px 24px auto;
        width: 430px;
        border-radius: var(--radius-xl);
        max-height: 80vh;
        max-height: 80dvh;
        transform: translateY(20px) scale(0.96);
    }

    dialog.bottom-sheet-dialog[open] {
        transform: translateY(0) scale(1);
    }

    @starting-style {
        dialog.bottom-sheet-dialog[open] {
            transform: translateY(20px) scale(0.96);
        }
    }
}

@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Dialog Header */
.sheet-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--clr-border);
    flex-shrink: 0;

    & h3 {
        font-size: var(--font-lg);
        font-weight: 700;
        color: var(--clr-text-main);
    }
}

.close-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;  /* 48px Touch Target */
    height: 48px; /* 48px Touch Target */
    border-radius: 50%;
    background-color: var(--clr-bg);
    color: var(--clr-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;

    &:hover {
        color: var(--clr-text-main);
        background-color: oklch(0 0 0 / 0.08);
    }

    &:active {
        transform: translateY(-50%) scale(0.92);
    }
}

.sheet-content {
    padding: var(--space-xs) 0 var(--space-md);
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;

    &::-webkit-scrollbar {
        display: none;
    }
}

/* List Items in Cart */
.wishlist-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.list-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--clr-border);
    max-height: 150px;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s var(--transition-smooth), max-height 0.3s ease;

    &.removing {
        opacity: 0;
        transform: translateX(40px);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-bottom-color: transparent;
    }

    &:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    & .item-img {
        width: 64px;
        height: 64px;
        border-radius: var(--radius-md);
        object-fit: cover;
        flex-shrink: 0;
    }

    & .list-item-info {
        flex-grow: 1;

        & h4 {
            font-size: var(--font-sm);
            font-weight: 600;
            color: var(--clr-text-main);
        }

        & .item-detail-text {
            font-size: var(--font-xs);
            color: var(--clr-text-muted);
            line-height: 1.4;
            margin-top: 2px;
        }

        & .item-qty-label {
            font-size: var(--font-xs);
            font-weight: 600;
            color: var(--clr-text-main);
            margin-top: 4px;
        }
    }
}

.item-delete-btn {
    width: 48px;  /* 48px Touch Target */
    height: 48px; /* 48px Touch Target */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--clr-text-muted);
    border-radius: 50%;
    flex-shrink: 0;
    transition: color 0.2s ease, background-color 0.2s ease;

    &:hover {
        color: #C0392B;
        background-color: oklch(0.6 0.2 25 / 0.1);
    }

    &:active {
        transform: scale(0.9);
    }
}

.item-qty-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--clr-bg);
    border-radius: var(--radius-full);
    padding: 4px;
    width: fit-content;
}

.qty-btn {
    width: 48px;  /* 48px Touch Target */
    height: 48px; /* 48px Touch Target */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--clr-text-main);
    border-radius: 50%;
    background-color: var(--clr-surface);
    border: 1px solid var(--clr-border);
    box-shadow: 0 2px 4px oklch(0 0 0 / 0.05);
    flex-shrink: 0;
    transition: background-color 0.2s ease, transform 0.2s ease;

    &:active {
        background: oklch(0 0 0 / 0.06);
        transform: scale(0.92);
    }
}

.item-qty {
    display: inline-block;
    font-size: var(--font-md);
    font-weight: 600;
    min-width: 2ch;
    text-align: center;

    &.pop {
        animation: qtyPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
}

@keyframes qtyPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-xl) var(--space-sm);
    color: var(--clr-text-muted);
    display: none;
    margin: auto 0;

    &.visible {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex-grow: 1;
        gap: var(--space-xs);
        animation: fadeIn 0.4s ease both;
    }

    & .empty-state-icon {
        width: 64px;
        height: 64px;
        border-radius: var(--radius-full);
        background: oklch(0.76 0.12 85 / 0.15);
        color: var(--clr-primary-dark);
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: var(--space-xs);
    }

    & h4 {
        font-size: var(--font-md);
        font-weight: 600;
        color: var(--clr-text-main);
    }

    & p {
        font-size: var(--font-sm);
        color: var(--clr-text-muted);
        max-width: 260px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Sheet Footer & Actions */
.sheet-footer {
    position: relative;
    margin-top: auto;
    padding: var(--space-md) 0 var(--space-xs);
    flex-shrink: 0;

    & .disclaimer {
        text-align: center;
        font-size: var(--font-xs);
        color: var(--clr-text-muted);
        margin-top: var(--space-sm);
    }
}

.primary-btn {
    min-height: 48px; /* 48px Touch Target */
    width: 100%;
    padding: 14px var(--space-md);
    background-color: var(--clr-text-main);
    color: var(--clr-surface);
    border-radius: var(--radius-full);
    font-size: var(--font-md);
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: 0 8px 24px oklch(0.24 0.018 45 / 0.22);
    transition: transform 0.25s ease, box-shadow 0.3s ease, background-color 0.4s ease;

    &:hover {
        background-color: oklch(0.18 0.018 45);
        box-shadow: 0 12px 28px oklch(0.24 0.018 45 / 0.28);
        transform: translateY(-2px);
    }

    &:active {
        transform: translateY(1px) scale(0.98);
    }

    &.btn-added {
        background-color: oklch(0.55 0.18 150);
        color: #FFFFFF;
        box-shadow: 0 8px 24px oklch(0.55 0.18 150 / 0.38);
        animation: btnSuccessPulse 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
}

@keyframes btnSuccessPulse {
    0% { transform: scale(1); }
    45% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

/* --- PRODUCT DETAIL MODAL --- */
.detail-hero {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);

    & img {
        width: 84px;
        height: 84px;
        border-radius: var(--radius-lg);
        object-fit: cover;
        cursor: pointer;
    }

    & .detail-hero-info {
        & h4 {
            font-size: var(--font-lg);
            font-weight: 700;
            color: var(--clr-text-main);
        }

        & .detail-subtitle {
            font-size: var(--font-xs);
            color: var(--clr-text-muted);
        }
    }
}

.option-group {
    margin-bottom: var(--space-lg);
    text-align: center;

    & .option-label {
        display: block;
        font-size: var(--font-sm);
        font-weight: 600;
        margin-bottom: var(--space-sm);
        color: var(--clr-text-main);

        & strong {
            color: var(--clr-accent);
        }
    }
}

.color-options {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.color-btn {
    width: 48px;  /* 48px Touch Target */
    height: 48px; /* 48px Touch Target */
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease;
    position: relative;
    box-shadow: 0 3px 8px oklch(0 0 0 / 0.12);

    &.selected {
        border-color: var(--clr-text-main);
        transform: scale(1.1);
    }
}

.fragrance-options {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.fragrance-chip {
    min-height: 48px; /* 48px Touch Target */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--clr-border);
    background-color: var(--clr-surface);
    color: var(--clr-text-main);
    font-size: var(--font-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;

    &.selected {
        background-color: var(--clr-text-main);
        color: var(--clr-surface);
        border-color: var(--clr-text-main);
    }
}

.detail-qty-controls {
    margin: 0 auto;
    border: 1px solid var(--clr-border);
}

.detail-qty-value {
    padding: 0 20px;
    font-size: var(--font-lg);
}

/* --- WHATSAPP & PRIVACY DIALOGS --- */
.wa-sheet-body {
    text-align: center;
    padding: var(--space-lg) var(--space-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.wa-icon-large {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: oklch(0.65 0.22 145 / 0.15);
    color: #25D366;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
}

.wa-contact-title {
    font-size: var(--font-lg);
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.wa-contact-text {
    font-size: var(--font-sm);
    color: var(--clr-text-muted);
    max-width: 300px;
    margin: 0 auto;
}

.wa-cta-btn {
    background-color: #25D366;
    color: #FFFFFF;
    text-decoration: none;

    &:hover {
        background-color: #1ebe5b;
    }
}

.legal-text {
    & h4 {
        font-size: var(--font-sm);
        margin-top: var(--space-md);
        margin-bottom: 4px;
        color: var(--clr-text-main);
    }

    & p {
        font-size: var(--font-xs);
        color: var(--clr-text-muted);
        margin-bottom: var(--space-sm);
        line-height: 1.6;
    }
}

/* --- NATIVE DIALOG: IMAGE VIEWER LIGHTBOX --- */
dialog.viewer-dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100vh;
    background: oklch(0 0 0 / 0.92);
    border: none;
    padding: var(--space-md);
    display: none;
    pointer-events: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.35s ease, display 0.35s allow-discrete, overlay 0.35s allow-discrete;

    &[open] {
        display: flex;
        pointer-events: auto;
        opacity: 1;
    }
}

@starting-style {
    dialog.viewer-dialog[open] {
        opacity: 0;
    }
}

.viewer-close-btn {
    position: absolute;
    top: calc(20px + env(safe-area-inset-top));
    right: 20px;
    width: 48px;  /* 48px Touch Target */
    height: 48px; /* 48px Touch Target */
    border-radius: 50%;
    background: oklch(1 0 0 / 0.2);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2001;

    &:hover {
        background: oklch(1 0 0 / 0.35);
    }
}

.viewer-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;

    & img {
        max-width: 100%;
        max-height: 85vh;
        max-height: 85dvh;
        border-radius: var(--radius-lg);
        object-fit: contain;
        touch-action: pan-x pan-y pinch-zoom;
    }
}

/* --- TOAST NOTIFICATION --- */
.toast {
    position: fixed;
    bottom: calc(var(--space-md) + 72px + 14px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(14px) scale(0.92);
    background: linear-gradient(135deg, oklch(0.60 0.16 155) 0%, oklch(0.50 0.16 155) 100%);
    color: #FFFFFF;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: var(--font-sm);
    font-weight: 600;
    box-shadow: 0 8px 24px oklch(0.50 0.16 155 / 0.35);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;

    &.show {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
        pointer-events: auto;
    }
}

/* --- STORAGE NOTICE BANNER --- */
.storage-notice {
    position: fixed;
    bottom: calc(88px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translate(-50%, 150%);
    opacity: 0;
    width: calc(100% - 2 * var(--space-md));
    max-width: 400px;
    background-color: var(--clr-surface);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-heavy);
    z-index: 3000;
    transition: transform 0.45s var(--transition-smooth), opacity 0.4s ease;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    border: 1px solid var(--clr-border);
    pointer-events: none;

    &.show {
        transform: translate(-50%, 0);
        opacity: 1;
        pointer-events: all;
    }

    & .storage-icon {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        background: oklch(0.76 0.12 85 / 0.15);
        color: var(--clr-primary-dark);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    & .storage-body {
        flex-grow: 1;

        & .storage-title {
            font-size: 13px;
            font-weight: 600;
            color: var(--clr-text-main);
        }

        & .storage-text {
            font-size: 11px;
            color: var(--clr-text-muted);
            line-height: 1.3;
        }
    }

    & .storage-accept-btn {
        min-height: 48px; /* 48px Touch Target */
        padding: 0 20px;
        font-size: 13px;
        font-weight: 600;
        color: var(--clr-surface);
        background-color: var(--clr-accent);
        border-radius: var(--radius-full);
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: transform 0.2s ease, background-color 0.2s ease;

        &:hover {
            background-color: oklch(0.48 0.035 55);
        }

        &:active {
            transform: scale(0.95);
        }
    }
}

/* --- SCROLL REVEAL (IntersectionObserver) --- */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.65s var(--transition-smooth), transform 0.65s var(--transition-smooth);
    will-change: opacity, transform;

    &.is-revealed {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- VIEW TRANSITIONS API SUPPORT --- */
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.28s;
    animation-timing-function: var(--transition-smooth);
}
