/* =========================================
   CSS VARIABLES (Light & Dark Modes)
   ========================================= */
:root {
    --md-primary: #FF6B8B;
    --md-primary-container: #FFD8E4;
    --md-secondary: #4ECDC4;
    --md-secondary-container: #C4F1EE;
    --md-tertiary: #FFD166;
    --md-tertiary-container: #FFF0C2;
    --md-quaternary: #9D88B3;
    --md-quaternary-container: #E8DEF8;

    /* Backgrounds & Text (Light Mode) */
    --bg-color: #F8F9FA;
    --surface-color: #FFFFFF;
    --text-main: #2D3436;
    --text-muted: #636E72;
    --border-color: #E2E8F0;

    --ios-shadow: 0 10px 40px -10px rgba(0,0,0,0.08);
    --ios-shadow-hover: 0 20px 50px -10px rgba(0,0,0,0.12);
    --ios-glass: rgba(255, 255, 255, 0.75);
    --ios-blur: blur(20px);

    /* Radii & Animation */
    --radius-pill: 9999px;
    --radius-squarcle: 32px;
    --radius-card: 24px;
    --spring-easing: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --smooth-easing: cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   DARK MODE OVERRIDES
   ========================================= */
[data-theme="dark"] {
    --bg-color: #0B0F19; /* Deep night sky */
    --surface-color: #1A202C; /* Dark UI Card */
    --text-main: #F8F9FA;
    --text-muted: #A0AEC0;
    --border-color: #2D3748;

    /* Darker, richer tones for the gradient background */
    --md-primary-container: #4A1D28;
    --md-quaternary-container: #231B38;

    --ios-shadow: 0 10px 40px -10px rgba(0,0,0,0.8);
    --ios-shadow-hover: 0 20px 50px -10px rgba(0,0,0,0.9);
}

/* =========================================
   BASE STYLES
   ========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

.hero, .categories, .bestsellers, .newsletter, footer {
    position: relative;
    z-index: 1; /* Puts content above the background animations */
}

h1, h2, h3, h4, h5, h6 { font-family: 'Fredoka', sans-serif; color: var(--text-main); font-weight: 600; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* =========================================
   BACKGROUND ANIMATIONS (Fixed Clickability)
   ========================================= */
.background-animations {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none !important;
    z-index: -1;
    overflow: hidden;
}

.day-scene, .night-scene {
    position: absolute; width: 100%; height: 100%;
    transition: opacity 0.8s ease;
    pointer-events: none;
}
[data-theme="light"] .night-scene { opacity: 0; }
[data-theme="light"] .day-scene { opacity: 1; }[data-theme="dark"] .day-scene { opacity: 0; }
[data-theme="dark"] .night-scene { opacity: 1; }

/* Day: Subtle SVG Clouds */
.day-scene div { position: absolute; pointer-events: none; }
.day-scene svg { width: 100%; height: 100%; }
.cloud-1 { width: 150px; top: 15%; left: -200px; color: #a4c8e1; opacity: 0.1; animation: floatRight 70s linear infinite; }
.cloud-2 { width: 250px; top: 50%; left: -300px; color: #a4c8e1; opacity: 0.08; animation: floatRight 90s linear infinite 15s; }
.cloud-3 { width: 120px; top: 75%; left: -150px; color: #a4c8e1; opacity: 0.12; animation: floatRight 60s linear infinite 40s; }

@keyframes floatRight {
    0% { transform: translateX(0) translateY(0); }
    50% { transform: translateX(60vw) translateY(-30px); }
    100% { transform: translateX(110vw) translateY(0); }
}

/* Night: SVG Stars */
.night-scene .star { position: absolute; color: #FFD166; opacity: 0.3; animation: twinkle 4s infinite alternate; pointer-events: none; }
.star svg { width: 100%; height: 100%; }
.star-1 { width: 30px; top: 10%; left: 20%; animation-delay: 0s; }
.star-2 { width: 15px; top: 30%; left: 80%; animation-delay: 1s; }
.star-3 { width: 40px; top: 70%; left: 15%; animation-delay: 2s; }
.star-4 { width: 25px; top: 50%; left: 60%; animation-delay: 3s; }

@keyframes twinkle {
    0% { opacity: 0.1; transform: scale(0.8); }
    100% { opacity: 0.7; transform: scale(1.2); }
}

.comet {
    position: absolute;
    top: 10%; right: 10%;
    width: 150px; height: 2px;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 80%, #ffffff 100%);
    border-radius: 50px;
    transform-origin: right center;
    opacity: 0;
    pointer-events: none;
    animation: shootingStar 20s infinite 10s;
}
.comet::after {
    content: ''; position: absolute; top: 50%; right: 0;
    width: 6px; height: 6px; background: #fff; border-radius: 50%;
    transform: translateY(-50%); box-shadow: 0 0 15px 4px rgba(255, 255, 255, 0.9);
}

@keyframes shootingStar {
    0% { transform: translateX(0) translateY(0) rotate(135deg); opacity: 0; }
    5% { opacity: 1; }
    10% { transform: translateX(-40vw) translateY(40vw) rotate(135deg); opacity: 0; }
    100% { opacity: 0; }
}

/* =========================================
   NAVIGATION & LOGO
   ========================================= */
header {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    width: 90%; max-width: 1200px; background: var(--ios-glass);
    backdrop-filter: var(--ios-blur); -webkit-backdrop-filter: var(--ios-blur);
    border: 1px solid rgba(150, 150, 150, 0.2); border-radius: var(--radius-pill); padding: 12px 24px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: var(--ios-shadow); transition: all 0.3s var(--smooth-easing);

    z-index: 1000;
}

.brand-logo { height: 40px; width: auto; transition: filter 0.3s ease; }
.footer-logo { height: 50px; }

.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { font-weight: 700; color: var(--text-muted); transition: color 0.2s; font-size: 1.1rem; }
.nav-links a:hover { color: var(--md-primary); }

/* Buttons */
.btn-primary {
    background: var(--md-primary); color: white; padding: 12px 28px;
    border-radius: var(--radius-pill); font-weight: 800; font-family: 'Fredoka', sans-serif;
    font-size: 1.1rem; border: none; cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 107, 139, 0.3); transition: transform 0.3s var(--spring-easing), box-shadow 0.3s;
}
.btn-primary:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 12px 25px rgba(255, 107, 139, 0.4); }
.btn-large { font-size: 1.3rem; padding: 16px 40px; }

.btn-secondary {
    background: var(--surface-color); color: var(--text-main);
    border: 2px solid var(--border-color); padding: 10px 24px; border-radius: var(--radius-pill);
    font-weight: 700; font-family: 'Fredoka', sans-serif; font-size: 1.1rem; transition: all 0.3s ease;
}
.btn-secondary:hover { background: var(--border-color); }

.btn-icon {
    background: var(--surface-color); color: var(--text-main); border: 2px solid var(--border-color);
    width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.3s var(--spring-easing);
}
.btn-icon:hover { transform: scale(1.1); background: var(--border-color); }

/* =========================================
   PAGE SECTIONS
   ========================================= */
.hero { padding: 160px 5% 80px; display: flex; align-items: center; justify-content: center; gap: 60px; max-width: 1200px; margin: 0 auto; min-height: 80vh; }
.hero-text { flex: 1; max-width: 500px; }
.tagline { background: var(--md-tertiary-container); color: #D4A017; padding: 8px 16px; border-radius: var(--radius-pill); display: inline-block; font-weight: 800; margin-bottom: 24px; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; }
.hero h1 { font-size: 4rem; line-height: 1.1; margin-bottom: 24px; }
.hero h1 span { color: var(--md-secondary); }
.hero p { font-size: 1.25rem; color: var(--text-muted); margin-bottom: 32px; }
.hero-img { flex: 1; position: relative; }
.blob-bg { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 120%; height: 120%; background: var(--md-secondary-container); border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; z-index: -1; pointer-events: none; animation: morph 8s ease-in-out infinite alternate; }

@keyframes morph {
    0% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
    100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}
.hero-img img { border-radius: var(--radius-squarcle); box-shadow: var(--ios-shadow); transform: rotate(3deg); transition: transform 0.5s var(--spring-easing); }
.hero-img img:hover { transform: rotate(0deg) scale(1.02); }

/* CATEGORIES (Standardized background color) */
.section-title { text-align: center; font-size: 2.5rem; margin-bottom: 48px; }
.categories { padding: 80px 5%; max-width: 1200px; margin: 0 auto; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 32px; }

/* The cards now strictly adapt to surface color, fixing readability issues in Dark Mode */
.cat-card { background: var(--surface-color); color: var(--text-main); border-radius: var(--radius-squarcle); padding: 24px; text-align: center; box-shadow: var(--ios-shadow); transition: all 0.4s var(--spring-easing); cursor: pointer; }
.cat-card:hover { transform: translateY(-10px) scale(1.03); box-shadow: var(--ios-shadow-hover); }
.cat-card img { width: 100%; height: 200px; object-fit: cover; border-radius: var(--radius-card); margin-bottom: 20px; }
.cat-card h3 { font-size: 1.5rem; }

/* Bestsellers */
.bestsellers { padding: 80px 5%; background: var(--surface-color); border-radius: 60px; margin: 0 20px; box-shadow: var(--ios-shadow); }
.store-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 32px; max-width: 1200px; margin: 0 auto; }
.product-card { background: var(--bg-color); border-radius: var(--radius-card); padding: 16px; box-shadow: var(--ios-shadow); transition: all 0.3s var(--smooth-easing); position: relative; }
.product-card:hover { box-shadow: var(--ios-shadow-hover); }
.product-img-wrap { border-radius: 16px; overflow: hidden; margin-bottom: 16px; }
.product-img-wrap img { width: 100%; aspect-ratio: 4/5; object-fit: cover; transition: transform 0.5s var(--spring-easing); }
.product-card:hover .product-img-wrap img { transform: scale(1.08); }
.product-info { padding: 8px; }
.product-info h4 { font-size: 1.2rem; margin-bottom: 4px; }
.product-price { font-weight: 800; color: var(--md-primary); font-size: 1.2rem; }

.fab-add { position: absolute; bottom: 24px; right: 24px; width: 48px; height: 48px; background: var(--md-secondary); color: white; border: none; border-radius: 16px; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 16px rgba(78, 205, 196, 0.4); cursor: pointer; transition: all 0.2s var(--spring-easing); }
.fab-add:hover { transform: scale(1.1) rotate(-5deg); background: #3eb8b0; }

/* NEWSLETTER */
.newsletter { padding: 100px 5%; text-align: center; }
.newsletter-card { background: linear-gradient(135deg, var(--md-quaternary-container), var(--md-primary-container)); max-width: 800px; margin: 0 auto; padding: 60px 40px; border-radius: var(--radius-squarcle); box-shadow: var(--ios-shadow); }
.newsletter-title { font-size: 2.5rem; margin-bottom: 16px; color: var(--text-main); }
.newsletter-text { font-size: 1.2rem; margin-bottom: 32px; color: var(--text-main); opacity: 0.9; }
.form-group { display: flex; gap: 16px; justify-content: center; max-width: 500px; margin: 0 auto; flex-wrap: wrap; }
.input-pill {
    flex: 1; min-width: 200px; padding: 16px 24px; border-radius: var(--radius-pill); border: none;
    font-family: 'Nunito', sans-serif; font-size: 1.1rem; outline: none;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05); transition: box-shadow 0.3s;
    background: var(--surface-color); color: var(--text-main);
}
.input-pill:focus { box-shadow: 0 0 0 4px rgba(255, 107, 139, 0.5); }

/* FOOTER */
footer { background: var(--surface-color); padding: 60px 5% 30px; border-top-left-radius: 40px; border-top-right-radius: 40px; box-shadow: 0 -10px 30px rgba(0,0,0,0.03); margin-top: 40px; }
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px; max-width: 1200px; margin: 0 auto 40px; }
.footer-col h4 { font-size: 1.3rem; margin-bottom: 20px; color: var(--md-primary); }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 12px; }
.footer-col ul li a { color: var(--text-muted); transition: color 0.2s; font-weight: 600; }
.footer-col ul li a:hover { color: var(--md-secondary); }
.social-links { display: flex; gap: 16px; }
.social-circle { width: 44px; height: 44px; background: var(--bg-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-main); transition: all 0.3s var(--spring-easing); }
.social-circle:hover { background: var(--md-tertiary); transform: translateY(-5px) scale(1.1); color: white; }
.footer-bottom { text-align: center; padding-top: 30px; border-top: 2px dashed var(--border-color); color: var(--text-muted); font-weight: 600; }

/* Responsive */
.menu-toggle { display: none; background: none; border: none; font-size: 2rem; color: var(--text-main); cursor: pointer; }
@media (max-width: 768px) {
    .hero { flex-direction: column; text-align: center; padding-top: 120px; }
    .hero h1 { font-size: 3rem; }
    .nav-links, .btn-secondary { display: none; }
    .menu-toggle { display: block; }
    .bestsellers { border-radius: 30px; padding: 40px 5%; margin: 0 10px; }
}

/* Scroll Animations */
.reveal { opacity: 0; transform: translateY(40px); transition: all 0.8s var(--spring-easing); }
.reveal.active { opacity: 1; transform: translateY(0); }