/* ===== BASE STYLES ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
    --primary: #8B1538;
    --dark: #5C0E24;
    --gold: #D4AF37;
    --cream: #FDF5E6;
    --green: #1D5C3E;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Quicksand', sans-serif;
}

html, body { height: 100%; font-family: var(--font-body); }

body {
    background: linear-gradient(180deg, var(--primary) 0%, var(--dark) 100%);
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== SCREENS ===== */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    padding-top: max(env(safe-area-inset-top, 20px), 20px);
    padding-bottom: max(env(safe-area-inset-bottom, 20px), 20px);
}
.screen.active { display: block; }

/* ===== SNOWFLAKES ===== */
.snowflakes { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: hidden; }
.snowflake { position: absolute; top: -10%; color: rgba(255,255,255,0.4); font-size: 1rem; animation: snowfall linear infinite; }
.snowflake:nth-child(1) { left: 10%; animation-duration: 10s; }
.snowflake:nth-child(2) { left: 30%; animation-duration: 12s; animation-delay: 1s; }
.snowflake:nth-child(3) { left: 50%; animation-duration: 8s; animation-delay: 2s; }
.snowflake:nth-child(4) { left: 70%; animation-duration: 14s; }
.snowflake:nth-child(5) { left: 90%; animation-duration: 11s; animation-delay: 3s; }
@keyframes snowfall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(110vh) rotate(360deg); opacity: 0.3; } }

/* ===== LOGIN ===== */
.login-container { max-width: 400px; margin: 0 auto; text-align: center; padding-top: 60px; position: relative; z-index: 1; }
.heart-icon { font-size: 4rem; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.login-title { font-family: var(--font-display); font-size: 2.5rem; margin: 20px 0 10px; }
.login-subtitle { font-size: 1rem; opacity: 0.9; margin-bottom: 40px; }
.login-form { text-align: left; }
.input-group { margin-bottom: 20px; }
.input-group label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 8px; }
.input-group input { width: 100%; padding: 16px; font-family: var(--font-body); font-size: 1rem; border: none; border-radius: 16px; background: rgba(255,255,255,0.95); color: var(--dark); }
.error-message { display: none; color: #FFD700; text-align: center; margin-bottom: 15px; font-weight: 600; }
.login-btn { width: 100%; padding: 18px; font-family: var(--font-body); font-size: 1.1rem; font-weight: 700; color: var(--dark); background: linear-gradient(135deg, var(--gold), #F4E4BA); border: none; border-radius: 16px; cursor: pointer; }

/* ===== HOME ===== */
.home-container { max-width: 600px; margin: 0 auto; position: relative; z-index: 1; }
.home-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.icon-btn { width: 44px; height: 44px; background: rgba(255,255,255,0.15); border: none; border-radius: 12px; color: white; font-size: 1.2rem; cursor: pointer; }
.user-greeting { font-size: 0.9rem; opacity: 0.9; }
.couple-icon { font-size: 2rem; }
.home-title { font-family: var(--font-display); font-size: 2rem; text-align: center; margin-bottom: 10px; }
.home-subtitle { text-align: center; font-size: 0.95rem; opacity: 0.9; margin-bottom: 30px; }

.months-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 30px; }
.month-btn { border: 2px solid rgba(255,255,255,0.3); border-radius: 16px; padding: 18px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; transition: transform 0.2s; color: white; }
.month-btn:active { transform: scale(0.96); }
.month-icon { font-size: 1.5rem; }
.month-name { font-size: 0.85rem; font-weight: 700; }

.special-days { background: rgba(255,255,255,0.1); border-radius: 16px; padding: 20px; text-align: center; }
.special-days h3 { font-family: var(--font-display); font-size: 1.1rem; margin-bottom: 15px; }
.special-day { font-size: 0.9rem; margin: 8px 0; opacity: 0.9; }

/* ===== CALENDAR ===== */
.calendar-container { max-width: 600px; margin: 0 auto; position: relative; z-index: 1; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.calendar-title { font-family: var(--font-display); font-size: 1.4rem; }
.calendar-decoration { font-size: 1.8rem; }

.info-box { background: rgba(255,255,255,0.15); border-radius: 14px; padding: 14px; margin-bottom: 20px; text-align: center; font-size: 0.85rem; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 8px; font-weight: 700; font-size: 0.8rem; }
.badge.er { background: rgba(100,149,237,0.3); }
.badge.sie { background: rgba(255,105,180,0.3); }

.calendar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.calendar-door { aspect-ratio: 1; perspective: 1000px; cursor: pointer; }
.calendar-door.disabled { cursor: not-allowed; opacity: 0.5; }

.door-inner { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.calendar-door.opening .door-inner, .calendar-door.opened .door-inner { transform: rotateY(-170deg); }

.door-front, .door-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.door-front { background: linear-gradient(145deg, var(--green), #2E8B57); border: 2px solid rgba(255,255,255,0.4); box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.door-front.alt { background: linear-gradient(145deg, #A91D3A, var(--primary)); }
.door-number { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: white; }
.starter-indicator { font-size: 0.8rem; margin-top: 2px; }
.door-back { background: linear-gradient(145deg, var(--gold), #F4E4BA); transform: rotateY(180deg); }
.door-content { font-size: 1.6rem; }

.calendar-door.today .door-front { animation: todayGlow 2s ease-in-out infinite; border-color: var(--gold); }
@keyframes todayGlow { 0%, 100% { box-shadow: 0 4px 10px rgba(0,0,0,0.3), 0 0 15px rgba(212,175,55,0.5); } 50% { box-shadow: 0 4px 10px rgba(0,0,0,0.3), 0 0 25px rgba(212,175,55,0.8); } }
.calendar-door.opened .door-front::after { content: '✓'; position: absolute; top: 4px; right: 6px; font-size: 0.7rem; color: var(--gold); }

/* ===== POPUP ===== */
.popup-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.popup-overlay.active { display: flex; }

.popup-content { background: linear-gradient(180deg, var(--cream) 0%, #FFF8DC 100%); border-radius: 24px; width: 100%; max-width: 380px; max-height: 90vh; overflow-y: auto; padding: 24px; transform: scale(0.8); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.popup-overlay.active .popup-content { transform: scale(1); }

.popup-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.popup-day { font-family: var(--font-display); font-weight: 600; color: var(--primary); background: rgba(139,21,56,0.1); padding: 6px 14px; border-radius: 20px; }
.popup-close { width: 36px; height: 36px; background: rgba(139,21,56,0.1); border: none; border-radius: 50%; color: var(--primary); font-size: 1.5rem; cursor: pointer; }

.popup-body { text-align: center; }
.popup-icon { font-size: 3.5rem; margin-bottom: 12px; animation: bounceIn 0.6s ease-out; }
@keyframes bounceIn { 0% { transform: scale(0); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }
.popup-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--dark); margin-bottom: 20px; }

.popup-tasks { text-align: left; }
.task-box { background: rgba(0,0,0,0.03); border-radius: 14px; padding: 16px; margin-bottom: 12px; border: 2px solid transparent; }
.task-box.highlight { background: rgba(212,175,55,0.15); border-color: var(--gold); }
.task-header { margin-bottom: 10px; }
.task-badge { display: inline-block; padding: 4px 10px; border-radius: 8px; font-weight: 700; font-size: 0.85rem; background: rgba(139,21,56,0.1); color: var(--dark); }
.task-text { font-size: 0.95rem; color: #444; line-height: 1.5; }
.task-divider { text-align: center; margin: 8px 0; font-size: 1.2rem; }

.popup-footer { margin-top: 20px; }
.popup-btn { width: 100%; padding: 16px; font-family: var(--font-body); font-size: 1rem; font-weight: 700; color: white; background: linear-gradient(135deg, var(--green), #2E8B57); border: none; border-radius: 14px; cursor: pointer; }

/* ===== RESPONSIVE ===== */
@media (max-width: 360px) {
    .calendar-grid { gap: 8px; }
    .door-number { font-size: 1.2rem; }
    .months-grid { gap: 10px; }
    .month-btn { padding: 14px 10px; }
}
