/* ==========================================================================
   SCENORA LUXURY PERFUMES - DESIGN SYSTEM (BLACK, GOLD & WHITE)
   Supports automatic device mode (prefers-color-scheme) & manual theme toggle.
   ========================================================================== */

/* Dark Mode Variables (Default for Luxury Perfumes) */
:root,
html.dark {
    --bg-page: #09090C;
    --bg-subtle: #0F0F14;
    --bg-header: rgba(9, 9, 12, 0.95);
    --bg-card: #131319;
    --bg-card-hover: #191922;
    --bg-panel: #101016;
    --bg-input: #15151C;
    --bg-drawer: #0D0D12;
    --text-primary: #FFFFFF;
    --text-secondary: #E4E4E7;
    --text-muted: #A1A1AA;
    --text-dim: #71717A;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-subtle-hover: rgba(255, 255, 255, 0.18);
    --border-gold: rgba(212, 175, 55, 0.32);
    --border-gold-hover: rgba(212, 175, 55, 0.7);
    --gold-primary: #D4AF37;
    --gold-light: #F3E5AB;
    --gold-dark: #99781E;
    --gold-gradient: #D4AF37;
    --gold-badge-bg: rgba(212, 175, 55, 0.15);
    --gold-badge-text: #F3E5AB;
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(212, 175, 55, 0.06);
    --shadow-card-hover: 0 20px 45px rgba(0, 0, 0, 0.8), 0 0 25px rgba(212, 175, 55, 0.2);
    --shadow-glow: 0 0 35px rgba(212, 175, 55, 0.25);
    --announcement-bg: #09090C;
    --announcement-border: rgba(212, 175, 55, 0.2);
    --announcement-text: #E4E4E7;
    --color-scheme: dark;
}

/* Light Mode Variables (Device Light Mode / Manual Light Toggle) */
@media (prefers-color-scheme: light) {
    :root:not(.dark) {
        --bg-page: #FAF8F5;
        --bg-subtle: #F3EFEA;
        --bg-header: rgba(250, 248, 245, 0.96);
        --bg-card: #FFFFFF;
        --bg-card-hover: #FDFBF8;
        --bg-panel: #F4EFE6;
        --bg-input: #FFFFFF;
        --bg-drawer: #FFFFFF;
        --text-primary: #121215;
        --text-secondary: #2C2C34;
        --text-muted: #6B6A78;
        --text-dim: #9493A2;
        --border-subtle: rgba(0, 0, 0, 0.08);
        --border-subtle-hover: rgba(0, 0, 0, 0.18);
        --border-gold: rgba(180, 140, 40, 0.32);
        --border-gold-hover: rgba(180, 140, 40, 0.8);
        --gold-primary: #B38728;
        --gold-light: #856404;
        --gold-dark: #664D03;
        --gold-gradient: #B38728;
        --gold-badge-bg: rgba(179, 135, 40, 0.12);
        --gold-badge-text: #856404;
        --shadow-card: 0 8px 25px rgba(20, 20, 25, 0.04), 0 1px 3px rgba(179, 135, 40, 0.07);
        --shadow-card-hover: 0 16px 40px rgba(20, 20, 25, 0.08), 0 0 25px rgba(179, 135, 40, 0.16);
        --shadow-glow: 0 0 35px rgba(179, 135, 40, 0.15);
        --announcement-bg: #F5F1EB;
        --announcement-border: rgba(180, 140, 40, 0.25);
        --announcement-text: #18181C;
        --color-scheme: light;
    }
}

html.light {
    --bg-page: #FAF8F5;
    --bg-subtle: #F3EFEA;
    --bg-header: rgba(250, 248, 245, 0.96);
    --bg-card: #FFFFFF;
    --bg-card-hover: #FDFBF8;
    --bg-panel: #F4EFE6;
    --bg-input: #FFFFFF;
    --bg-drawer: #FFFFFF;
    --text-primary: #121215;
    --text-secondary: #2C2C34;
    --text-muted: #6B6A78;
    --text-dim: #9493A2;
    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-subtle-hover: rgba(0, 0, 0, 0.18);
    --border-gold: rgba(180, 140, 40, 0.32);
    --border-gold-hover: rgba(180, 140, 40, 0.8);
    --gold-primary: #B38728;
    --gold-light: #856404;
    --gold-dark: #664D03;
    --gold-gradient: #B38728;
    --gold-badge-bg: rgba(179, 135, 40, 0.12);
    --gold-badge-text: #856404;
    --shadow-card: 0 8px 25px rgba(20, 20, 25, 0.04), 0 1px 3px rgba(179, 135, 40, 0.07);
    --shadow-card-hover: 0 16px 40px rgba(20, 20, 25, 0.08), 0 0 25px rgba(179, 135, 40, 0.16);
    --shadow-glow: 0 0 35px rgba(179, 135, 40, 0.15);
    --announcement-bg: #F5F1EB;
    --announcement-border: rgba(180, 140, 40, 0.25);
    --announcement-text: #18181C;
    --color-scheme: light;
}

/* ==========================================================================
   GLOBAL RESET & THEMED FOUNDATIONS
   ========================================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    color-scheme: var(--color-scheme);
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    transition: background-color 0.35s ease, color 0.35s ease;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Typography Helpers - Glamorous Haute Parfumerie with Standard High-Clarity Fallbacks */
.font-cinzel { font-family: 'Cinzel', 'Playfair Display', Georgia, serif; letter-spacing: 0.04em; }
.font-serif { font-family: 'Playfair Display', Georgia, Cambria, 'Times New Roman', serif; }
.font-sans { font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
.font-outfit { font-family: 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif; }

.gold-gradient-text {
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Theme Elements */
.theme-bg { background-color: var(--bg-page) !important; }
.theme-bg-subtle { background-color: var(--bg-subtle) !important; }
.theme-header { background-color: var(--bg-header) !important; }
.theme-panel { background-color: var(--bg-panel) !important; border-color: var(--border-subtle) !important; }
.theme-card {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-subtle) !important;
    box-shadow: var(--shadow-card);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.theme-card:hover {
    background-color: var(--bg-card-hover) !important;
    border-color: var(--border-gold-hover) !important;
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-4px);
}

.theme-text { color: var(--text-primary) !important; }
.theme-text-secondary { color: var(--text-secondary) !important; }
.theme-text-muted { color: var(--text-muted) !important; }
.theme-border { border-color: var(--border-subtle) !important; }
.theme-border-gold { border-color: var(--border-gold) !important; }

.theme-input {
    background-color: var(--bg-input) !important;
    border: 1px solid var(--border-subtle) !important;
    color: var(--text-primary) !important;
    transition: border-color 0.2s ease;
}
.theme-input::placeholder {
    color: var(--text-dim) !important;
    opacity: 0.85;
}
.theme-input:focus {
    border-color: var(--gold-primary) !important;
    outline: none;
}
select.theme-input option,
.theme-input option {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* Luxury Buttons - Pure Solid Luxury Gold */
.btn-gold {
    background-color: #D4AF37 !important;
    background: #D4AF37 !important;
    color: #08080a !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: none !important;
    padding: 12px 24px;
    border-radius: 12px;
    border: 1px solid #c29b2b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}
.btn-gold:hover {
    background-color: #c59f2e !important;
    background: #c59f2e !important;
    border-color: #b58f24;
    color: #08080a !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(212, 175, 55, 0.35) !important;
}

.btn-outline-gold {
    background: transparent !important;
    color: #D4AF37 !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none !important;
    padding: 11px 22px;
    border-radius: 12px;
    border: 1px solid #D4AF37;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}
.btn-outline-gold:hover {
    background: rgba(212, 175, 55, 0.15) !important;
    border-color: #D4AF37 !important;
    color: #D4AF37 !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(212, 175, 55, 0.2) !important;
}

html.light .btn-outline-gold {
    color: #926C15 !important;
    border-color: #B38728 !important;
}
html.light .btn-outline-gold:hover {
    background: rgba(179, 135, 40, 0.12) !important;
    color: #7A570A !important;
    border-color: #926C15 !important;
}

/* Payment & Shipping Selection Cards (Dark & Light Mode) */
.choice-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s ease;
}
.choice-card:hover {
    border-color: var(--border-gold);
}
.choice-card.active,
.choice-card:has(input[type="radio"]:checked) {
    background-color: var(--bg-card);
    border: 2px solid var(--gold-primary);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.15);
}

/* Cart Drawer */
#cart-drawer {
    background-color: var(--bg-drawer);
    border-left: 1px solid var(--border-gold);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-x: hidden;
}
.cart-item-thumb {
    width: 68px !important;
    height: 68px !important;
    min-width: 68px !important;
    min-height: 68px !important;
    max-width: 68px !important;
    max-height: 68px !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
    border-radius: 8px !important;
}
#cart-drawer.translate-x-full {
    transform: translateX(100%);
}
#cart-drawer:not(.translate-x-full) {
    transform: translateX(0);
}

/* Quick View Modal Animation */
@keyframes modalPop {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}
.animate-modal-pop {
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Toast styling */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 90vw;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    background: var(--bg-card);
    border: 1px solid var(--gold-primary);
    color: var(--text-primary);
    padding: 13px 20px;
    border-radius: 3px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    animation: toastSlide 0.3s ease forwards;
}
@keyframes toastSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   MOBILE & RESPONSIVE BEHAVIOR (ANY DEVICE / ALL SCREEN RESOLUTIONS)
   ========================================================================== */
html, body {
    width: 100%;
    overflow-x: hidden;
    position: relative;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

/* Ensure all images, videos, and SVGs are responsive by default */
img, video, canvas, svg {
    max-width: 100%;
    height: auto;
}

/* Prevent unwanted iOS auto-zoom on form inputs */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

.hero-showcase-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: 1100px !important;
    margin: 0 auto !important;
}

/* Mobile Screens (<= 640px) */
@media (max-width: 640px) {
    #cart-drawer {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Full-width buttons only when explicitly requested */
    .btn-gold.w-full,
    .btn-outline-gold.w-full,
    .w-full > .btn-gold,
    .w-full > .btn-outline-gold {
        width: 100% !important;
    }

    /* Modal dialogs fit comfortable within screen margins */
    #search-modal > div,
    #auth-modal > div {
        max-height: 90vh;
        overflow-y: auto;
        margin: auto 12px;
    }

    /* Toasts repositioned cleanly */
    #toast-container {
        left: 16px !important;
        right: 16px !important;
        bottom: 16px !important;
        max-width: calc(100vw - 32px) !important;
        align-items: center;
    }
    .toast {
        width: 100%;
        justify-content: center;
    }
}

/* Tablet Screens (641px to 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
    #cart-drawer {
        max-width: 420px !important;
    }
}

/* Landscape Phones */
@media (max-height: 500px) and (orientation: landscape) {
    #mobile-menu {
        max-height: 75vh;
        overflow-y: auto;
    }
}

/* Safe area insets for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
    #cart-drawer {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
