/* Advent Calendar - North Pole Village Styles */

/* Import Google Fonts - Fredoka (Chunky, Toy-like) + Nunito (Readable) */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@400;600;700;800&display=swap');

/* CSS Variables */
:root {
    /* Cozy North Pole Night palette */
    --christmas-red: #dc2626;
    --christmas-dark-red: #991b1b;
    --christmas-crimson: #7f1d1d;
    --christmas-green: #166534;
    --pine-green: #166534;
    --holly-green: #15803d;
    --christmas-gold: #fbbf24;
    --warm-white: #f8fafc;
    --snow-white: #fffafa;
    --ice-blue: #60a5fa;

    /* Night sky gradient */
    --night-deep: #0f172a;
    --night-mid: #1e1b4b;
    --night-blue: #0a1929;

    /* Fonts - Fredoka for headings (Chunky/Toy-like), Nunito for body */
    --font-display: 'Fredoka', sans-serif;
    --font-body: 'Nunito', sans-serif;

    /* Shadows */
    --shadow: rgb(0 0 0 / 20%);
    --hover-shadow: rgb(0 0 0 / 40%);

    /* Icons - Padlock SVG for locked calendar cells with drop shadow for visibility */
    --icon-padlock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cdefs%3E%3Cfilter id='shadow' x='-20%25' y='-20%25' width='140%25' height='140%25'%3E%3CfeDropShadow dx='0' dy='1' stdDeviation='1' flood-color='black' flood-opacity='0.5'/%3E%3C/filter%3E%3C/defs%3E%3Cpath d='M12 1C8.676 1 6 3.676 6 7v2H4v14h16V9h-2V7c0-3.324-2.676-6-6-6zm0 2c2.276 0 4 1.724 4 4v2H8V7c0-2.276 1.724-4 4-4z' filter='url(%23shadow)'/%3E%3C/svg%3E");
}

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

body {
    font-family: var(--font-body);
    background: radial-gradient(ellipse at center, var(--night-mid) 0%, var(--night-deep) 70%);
    color: var(--warm-white);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Modal open state - prevent body scrolling */
body.modal-open {
    overflow: hidden;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Glass Pill Navigation - Fixed Top Center */
.glass-nav {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgb(255 255 255 / 10%);
    backdrop-filter: blur(12px);
    border: 1px solid rgb(255 255 255 / 20%);
    border-radius: 9999px;
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    color: var(--warm-white);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link:focus {
    background: rgb(255 255 255 / 15%);
}

.nav-link-active {
    background: rgb(255 255 255 / 20%);
}

/* Hide old nav bar */
.nav-bar {
    display: none;
}

/* Header */
.advent-header {
    text-align: center;
    padding: 6rem 1rem 2rem;
    animation: fade-in-down 0.8s ease-out;
}

.advent-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--warm-white);
}

.advent-subtitle {
    font-family: var(--font-body);
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--christmas-gold);
    font-weight: 600;
}

/* Main Content */
.advent-main {
    padding: 2rem 1rem 4rem;
    max-width: 1400px;
    margin: 0 auto;
}

.advent-container {
    background: rgb(255 255 255 / 10%);
    backdrop-filter: blur(16px);
    border-radius: 32px;
    padding: 3rem;
    box-shadow: 
        0 10px 50px rgb(0 0 0 / 30%),
        inset 0 1px 1px rgb(255 255 255 / 10%);
    border: 1px solid rgb(255 255 255 / 15%);
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 4rem;
    color: var(--warm-white);
}

.loading-spinner {
    display: inline-block;
    font-size: 4rem;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error State */
.error-state {
    text-align: center;
    padding: 4rem;
    color: var(--christmas-dark-red);
}

/* Grid Container */
.grid-container {
    width: 100%;
    margin: 0 auto;
}

.advent-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.25rem;
}

/* Calendar Cell Styles - Chunky 3D Buttons */
.calendar-cell {
    aspect-ratio: 1;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    border: none;
    color: var(--warm-white);
}

.calendar-cell:hover,
.calendar-cell:focus {
    transform: translateY(-4px);
    outline: none;
}

.calendar-cell:active {
    transform: translateY(2px);
}

.calendar-cell.unlocked {
    animation: none;
}

.calendar-cell.locked {
    filter: brightness(0.6);
    opacity: 0.7;
    cursor: not-allowed;
}

.calendar-cell.locked::after {
    content: '';
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 16px;
    height: 16px;
    background-image: var(--icon-padlock);
    background-size: contain;
    opacity: 0.6;
}

.calendar-cell.locked:hover {
    transform: translateY(-2px);
}

@keyframes unlock-pulse {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.12);
        filter: brightness(1.4);
    }

    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

/* 3D Flip Animation for Calendar Doors */
@keyframes flip-open {
    0% {
        transform: perspective(600px) rotateY(0deg);
    }

    50% {
        transform: perspective(600px) rotateY(-90deg);
    }

    100% {
        transform: perspective(600px) rotateY(-180deg);
    }
}

.calendar-cell.opening {
    animation: flip-open 0.6s ease-in-out;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.3s ease-out;
}

/* Modal visibility */
.modal.hidden {
    display: none !important;
}

.modal:not(.hidden) {
    display: flex !important;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(0 0 0 / 70%);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgb(0 0 0 / 50%);
    animation: slide-up 0.4s ease-out;
    z-index: 1001;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--christmas-red);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1002;
}

.modal-close:hover,
.modal-close:focus {
    background: var(--christmas-dark-red);
    transform: rotate(90deg);
    outline: 2px solid var(--christmas-gold);
    outline-offset: 2px;
}

.modal-header {
    padding: 2rem 2rem 1rem;
    border-bottom: 2px solid var(--christmas-gold);
    background: linear-gradient(180deg, var(--christmas-red) 0%, var(--christmas-dark-red) 100%);
    color: var(--warm-white);
    border-radius: 16px 16px 0 0;
}

.modal-day-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.modal-content-type {
    font-family: var(--font-body);
    font-size: 1rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-body {
    padding: 2rem;
    color: var(--night-deep);
    font-family: var(--font-body);
}

.modal-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1rem 0;
}

.modal-body p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

.modal-body h3 {
    color: var(--christmas-red);
    margin: 1.5rem 0 1rem;
}

.modal-body ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.modal-body li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Quiz Styles */
.quiz-question {
    margin-bottom: 2rem;
}

.quiz-question h4 {
    color: var(--christmas-green);
    margin-bottom: 1rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quiz-option {
    padding: 0.75rem 1rem;
    background: #f0f0f0;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quiz-option:hover {
    background: #e0e0e0;
    border-color: var(--christmas-gold);
}

.quiz-option.correct {
    background: #d4edda;
    border-color: var(--christmas-green);
}

.quiz-option.incorrect {
    background: #f8d7da;
    border-color: var(--christmas-red);
}

/* Animations */
@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fade-in-down {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (width <= 768px) {
    .nav-container {
        gap: 1rem;
    }

    .nav-link {
        font-size: 0.875rem;
        padding: 0.4rem 0.75rem;
    }

    .advent-container {
        padding: 1rem;
    }

    .grid-container {
        padding: 1.5rem;
    }

    .advent-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem;
    }

    .modal-content {
        max-width: 95%;
        max-height: 90vh;
    }

    .modal-header {
        padding: 1.5rem 1rem 1rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .modal-day-title {
        font-size: 1.5rem;
    }
}

@media (width <= 480px) {
    .advent-header {
        padding: 2rem 0.5rem 1.5rem;
    }

    .advent-main {
        padding: 1rem 0.5rem 2rem;
    }

    .advent-container {
        padding: 2rem 1.5rem;
    }

    .grid-container {
        padding: 0;
    }

    .advent-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }

    .calendar-cell {
        font-size: 1.5rem;
    }

    .nav-link span:not([aria-hidden]) {
        display: none;
    }

    .nav-link {
        padding: 0.5rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .nav-link:focus,
    .calendar-cell:focus,
    .modal-close:focus {
        outline: 3px solid;
        outline-offset: 3px;
    }
}

/* Focus Styles */
*:focus {
    outline: 2px solid var(--christmas-gold);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

/* Locked Message Styles */
.locked-message-container {
    text-align: center;
    padding: 2rem;
}

.locked-message-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.locked-message-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.locked-message-text {
    color: #666;
}

/* Error Message Styles */
.error-message-container {
    text-align: center;
    padding: 2rem;
    color: var(--christmas-red);
    font-weight: 600;
}

/* Game Content Styles */
.game-container {
    text-align: center;
}

.game-info {
    margin-top: 1.5rem;
}

.game-url-box {
    margin-top: 1rem;
    padding: 1rem;
    background: #f0f0f0;
    border-radius: 8px;
}

/* Activity Content Styles */
.activity-container {
    text-align: center;
}

.recipe-section {
    text-align: left;
    margin-top: 1.5rem;
}

.recipe-heading {
    color: var(--christmas-green);
    margin-top: 1rem;
}

.recipe-heading:first-child {
    margin-top: 0;
}

.ingredient-list {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.activity-url-box {
    margin-top: 1rem;
    padding: 1rem;
    background: #f0f0f0;
    border-radius: 8px;
}

/* Video Content Styles */
.video-container {
    text-align: center;
}

.video-info {
    margin-top: 1rem;
}

.special-message-box {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--christmas-red), var(--christmas-green));
    color: white;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
}

.video-url-box {
    margin-top: 1rem;
    padding: 1rem;
    background: #f0f0f0;
    border-radius: 8px;
}

/* Quiz Container */
.quiz-container {
    margin-top: 1.5rem;
}

/* Quiz Options Unavailable */
.quiz-options-unavailable {
    display: block;
    padding: 1rem;
    color: var(--christmas-red);
    font-style: italic;
}
