/* --- THEME DEFINITIONS --- */

/* 3. Christmas Theme (Winter Night) - Forced for debugging */
:root, .theme-christmas { /* Define on :root and theme-christmas for direct application */
    --color-bg-primary: #0f2238;    /* Dark Blue surface for cards/modals */
    --color-bg-secondary: #0d1a2e; /* Very Dark Blue (like a winter night) for main body */
    --color-nav-bg: #8B0000;       /* Deep red for nav/header accent */
    --color-text-primary: #e0f2fe; /* Light blue text */
    --color-text-secondary: #a3b3ac;
    --color-border: #c0a060; /* Gold/Bronze for borders */
    --color-accent: #e11d48; /* Festive Red */
    --color-accent-text: #ffffff;
    --color-danger-bg: #b91c1c; /* Darker red for danger */
    --color-danger-text: #ffffff;
    --color-success-bg: #047857; /* Darker green for success */
    --color-success-text: #ffffff;
    --color-info-bg: #1a2b42; /* A shade of blue for info boxes */
    --color-info-text: #bfdbfe;
    --color-input-bg: #2c3e5a;
    --color-input-text: #e0f2fe;
    --color-header-managed-bg: #1a2b42;
    --color-header-managed-text: #d1fae5;
    --color-header-other-bg: #1a2b42;
    --color-header-other-text: #bfdbfe;
}

/* --- General Styles --- */
/* --- Navbar Snowflakes --- */
.nav-snowflakes-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.nav-snowflake {
    color: white; /* Will use the text color of the navbar */
    font-size: 1.5rem;
    margin: 0 5px;
    text-shadow: 0 0 5px #e0f2fe, 0 0 10px #e0f2fe;
}

/* Flash messages */
.flash-bar {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(15, 34, 54, 0.96), rgba(18, 54, 78, 0.9));
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255,255,255,0.05);
    padding: 0.7rem 1.2rem;
    text-align: center;
    color: var(--color-text-primary);
    
}
.flash-bar[data-cat="success"] {
    border-color: #0ea5e9;
    background: linear-gradient(135deg, rgba(14, 52, 78, 0.96), rgba(12, 40, 64, 0.9));
}
.flash-bar[data-cat="danger"] {
    border-color: #e11d48;
    background: linear-gradient(135deg, rgba(45, 14, 26, 0.96), rgba(60, 18, 32, 0.9));
}
.flash-bar[data-cat="info"] {
    border-color: #38bdf8;
    background: linear-gradient(135deg, rgba(20, 42, 70, 0.96), rgba(18, 36, 58, 0.9));
}
.flash-text {
    position: relative;
    z-index: 1;
    font-weight: 600;
}
body {
    background-color: var(--color-bg-secondary); /* Use secondary as base background */
    color: var(--color-text-primary);
    position: relative;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* Card blur behavior (items only) */
.blur-card {
    transition: transform 0.2s ease;
}
.blur-enabled .blur-card[data-self="0"] .blur-content {
    filter: blur(5px);
    opacity: 0.8;
    transition: filter 0.2s ease, opacity 0.2s ease;
}
.blur-enabled .blur-card[data-self="0"]:hover .blur-content {
    filter: blur(0);
    opacity: 1;
}

.shopping-grid {
    display: grid;
    grid-template-columns: 5fr 3fr 1fr 1fr;
    align-items: center;
    gap: 0.5rem;
}

/* --- Modal styles --- */
.modal.hidden { display: none; }
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(2px);
}
.modal-content {
    position: relative;
    width: 95%;
    max-width: 480px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    box-shadow: 0 15px 45px rgba(0,0,0,0.35);
    padding: 1.5rem;
    z-index: 1;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    color: var(--color-text-primary);
}
.modal-body {
    color: var(--color-text-primary);
}
.modal-close {
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    font-size: 1.25rem;
    cursor: pointer;
}

/* --- FESTIVE DECORATIONS --- */
.festive-season::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100px;
    height: 100px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e11d48' d='M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4z'/%3E%3C/svg%3E"); /* Simple ornament SVG */
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 10;
    opacity: 0.2;
    transform: rotate(-15deg);
}
.festive-season::after {
    content: '';
    position: fixed;
    top: 50px; /* slightly higher but clear of nav actions */
    right: 0;
    width: 120px;
    height: 120px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e11d48' d='M12 1.5l2.65 5.37 5.92.86-4.28 4.17 1.01 5.88L12 15.97 6.7 17.78l1.01-5.88-4.28-4.17 5.92-.86z'/%3E%3C/svg%3E"); /* Red ornament/star */
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 1;
    opacity: 0.2;
    transform: rotate(15deg);
    pointer-events: none;
}

/* --- Snowflake Animation --- */
.snowflakes {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: -1; /* Place behind content */
}
@keyframes fall {
    0% {transform: translateY(-10vh) translateX(0); opacity: 0.9;}
    100% {transform: translateY(110vh) translateX(2vw); opacity: 0.9;}
}
.snowflake {
    position: absolute; color: white;
    animation-name: fall; animation-timing-function: linear;
    animation-iteration-count: infinite;
    text-shadow: 0 0 10px #e0f2fe, 0 0 20px #e0f2fe, 0 0 30px #bfdbfe, 0 0 40px #bfdbfe;
}
.snowflake:nth-child(1) { left: 10%; animation-duration: 10s; font-size: 1.2rem; animation-delay: 0s; }
.snowflake:nth-child(2) { left: 20%; animation-duration: 12s; font-size: 1.5rem; animation-delay: 1s; }
.snowflake:nth-child(3) { left: 30%; animation-duration: 8s; font-size: 0.8rem; animation-delay: 2s; }
.snowflake:nth-child(4) { left: 40%; animation-duration: 15s; font-size: 1.7rem; animation-delay: 0.5s; }
.snowflake:nth-child(5) { left: 50%; animation-duration: 9s; font-size: 1.1rem; animation-delay: 3s; }
.snowflake:nth-child(6) { left: 60%; animation-duration: 11s; font-size: 1.4rem; animation-delay: 1.5s; }
.snowflake:nth-child(7) { left: 70%; animation-duration: 13s; font-size: 0.9rem; animation-delay: 2.5s; }
.snowflake:nth-child(8) { left: 80%; animation-duration: 7s; font-size: 1.6rem; animation-delay: 0.3s; }
.snowflake:nth-child(9) { left: 90%; animation-duration: 14s; font-size: 1.3rem; animation-delay: 1s; }
.snowflake:nth-child(10) { left: 5%; animation-duration: 18s; font-size: 1.0rem; animation-delay: 4s; }
.snowflake:nth-child(11) { left: 25%; animation-duration: 10s; font-size: 1.3rem; animation-delay: 0.7s; }
.snowflake:nth-child(12) { left: 45%; animation-duration: 16s; font-size: 0.9rem; animation-delay: 3.5s; }
.snowflake:nth-child(13) { left: 65%; animation-duration: 12s; font-size: 1.6rem; animation-delay: 1.2s; }
.snowflake:nth-child(14) { left: 85%; animation-duration: 9s; font-size: 1.1rem; animation-delay: 2.8s; }
.snowflake:nth-child(15) { left: 15%; animation-duration: 14s; font-size: 1.4rem; animation-delay: 0.1s; }

/* Santa cameo */
.santa-sprite {
    position: fixed;
    bottom: 10%;
    left: -20vw;
    width: 64px;
    height: 64px;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    pointer-events: none;
    z-index: 1200;
    animation: santa-walk 10s ease-in-out forwards, santa-steps 0.8s steps(6) infinite;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.35));
}
@keyframes santa-walk {
    0%   { transform: translateX(0vw) translateY(0); opacity: 0; }
    10%  { transform: translateX(30vw) translateY(0); opacity: 1; }
    50%  { transform: translateX(60vw) translateY(-2px); opacity: 1; }
    80%  { transform: translateX(90vw) translateY(0); opacity: 1; }
    100% { transform: translateX(140vw) translateY(2px); opacity: 0; }
}
@keyframes santa-steps {
    from { background-position: 0 0; }
    to   { background-position: -384px 0; } /* 64px * 6 frames */
}

/* --- Responsiveness --- */
@media (max-width: 992px) {
    .nav-snowflakes-container {
        transform: translate(-50%, -50%) scale(0.9);
    }
    .nav-snowflake {
        font-size: 1.25rem;
        margin: 0 3px;
    }
    .festive-season::before {
        width: 80px;
        height: 80px;
    }
    .festive-season::after {
        width: 90px;
        height: 90px;
        top: 45px;
    }
    .shopping-grid {
        grid-template-columns: 2.5fr 2fr 1fr 1fr;
        gap: 0.35rem;
    }
    .modal-content {
        width: 96%;
        padding: 1.1rem;
    }
}

@media (max-width: 640px) {
    .nav-snowflakes-container {
        display: none;
    }
    .shopping-grid {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }
    .shopping-grid > * {
        width: 100%;
    }
    .modal-content {
        max-width: 420px;
        padding: 1rem;
    }
}
