/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-red: #C41E3A;
    --primary-green: #165B33;
    --gold: #FFD700;
    --snow-white: #FFFAFA;
    --dark-bg: #0a1612;
    --card-bg: rgba(255, 255, 255, 0.95);
    --locked-bg: rgba(200, 200, 200, 0.3);
    --shadow: rgba(0, 0, 0, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0a1612 0%, #1a3a2e 50%, #0a1612 100%);
    min-height: 100vh;
    color: var(--snow-white);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Password Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a1612 0%, #1a3a2e 50%, #0a1612 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 400px;
    width: 90%;
}

.password-container {
    text-align: center;
}

.password-container h2 {
    color: var(--gold);
    margin-bottom: 1rem;
    font-size: 2rem;
}

.password-container p {
    margin-bottom: 1.5rem;
    color: var(--snow-white);
}

.password-container input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--primary-green);
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.password-container input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.2);
}

.password-container button {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-red), #8B0000);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.password-container button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(196, 30, 58, 0.4);
}

.password-container button:active {
    transform: translateY(0);
}

.error-message {
    color: var(--primary-red);
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 1.2rem;
}

.hidden {
    display: none !important;
}

/* Header */
header {
    text-align: center;
    padding: 2rem 1rem 1rem;
    position: relative;
    z-index: 10;
}

header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--gold);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.5rem;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5), 0 0 10px rgba(255, 215, 0, 0.5);
    }
    to {
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.8);
    }
}

.subtitle {
    font-size: 1.2rem;
    color: var(--snow-white);
    opacity: 0.9;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

@media (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.8rem;
        padding: 1rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .calendar-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.6rem;
    }
}

/* Calendar Day Card */
.calendar-day {
    aspect-ratio: 1;
    background: var(--card-bg);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px var(--shadow);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.calendar-day::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-red), var(--primary-green));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.calendar-day:hover::before {
    opacity: 0.1;
}

.calendar-day.unlocked:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 16px rgba(196, 30, 58, 0.4);
}

.calendar-day.unlocked:active {
    transform: translateY(-2px) scale(1.02);
}

.day-number {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: bold;
    color: var(--primary-red);
    position: relative;
    z-index: 1;
}

.day-icon {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-top: 0.5rem;
    position: relative;
    z-index: 1;
}

/* Locked State */
.calendar-day.locked {
    background: var(--locked-bg);
    cursor: not-allowed;
    opacity: 0.6;
    backdrop-filter: blur(3px);
}

.calendar-day.locked .day-number {
    color: #666;
}

.calendar-day.locked .day-icon {
    filter: grayscale(100%);
}

.calendar-day.locked::after {
    content: '🔒';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.2rem;
    opacity: 0.7;
}

/* Unlocked Animation */
.calendar-day.unlocked {
    animation: unlock 0.5s ease-out;
}

@keyframes unlock {
    0% {
        transform: scale(0.8) rotate(-5deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(2deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Today Highlight */
.calendar-day.today {
    border: 3px solid var(--gold);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 6px var(--shadow), 0 0 0 0 rgba(255, 215, 0, 0.7);
    }
    50% {
        box-shadow: 0 4px 6px var(--shadow), 0 0 0 10px rgba(255, 215, 0, 0);
    }
}

/* Snowflakes Animation */
.snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.snowflake {
    position: absolute;
    top: -10%;
    color: var(--snow-white);
    font-size: 1.5rem;
    animation: fall linear infinite;
    opacity: 0.8;
}

@keyframes fall {
    to {
        transform: translateY(105vh) rotate(360deg);
    }
}

.snowflake:nth-child(1) { left: 10%; animation-duration: 10s; animation-delay: 0s; }
.snowflake:nth-child(2) { left: 20%; animation-duration: 12s; animation-delay: 2s; font-size: 2rem; }
.snowflake:nth-child(3) { left: 30%; animation-duration: 8s; animation-delay: 4s; }
.snowflake:nth-child(4) { left: 40%; animation-duration: 15s; animation-delay: 0s; font-size: 1.2rem; }
.snowflake:nth-child(5) { left: 50%; animation-duration: 11s; animation-delay: 3s; }
.snowflake:nth-child(6) { left: 60%; animation-duration: 13s; animation-delay: 1s; font-size: 1.8rem; }
.snowflake:nth-child(7) { left: 70%; animation-duration: 9s; animation-delay: 5s; }
.snowflake:nth-child(8) { left: 80%; animation-duration: 14s; animation-delay: 2s; font-size: 1.3rem; }

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--snow-white);
    opacity: 0.8;
    position: relative;
    z-index: 10;
}

footer p {
    font-size: 1rem;
}

/* iOS Specific Fixes */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-tap-highlight-color: transparent;
    }
    
    .calendar-day {
        -webkit-tap-highlight-color: transparent;
        -webkit-user-select: none;
    }
    
    input {
        -webkit-appearance: none;
        border-radius: 10px;
    }
}

/* Smooth scroll for iOS */
html {
    -webkit-overflow-scrolling: touch;
}
