/* Global Reset & Base Styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Transitions */
    --theme-transition: all 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    /* Default variables (will be overridden by themes) */
    --bg-gradient: linear-gradient(135deg, #f59e0b, #d97706, #b45309);
    --card-bg: rgba(255, 255, 255, 0.12);
    --card-border: rgba(255, 255, 255, 0.2);
    --card-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    --text-color: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --accent: #fef08a;
    --panel-bg: rgba(255, 255, 255, 0.08);
    --panel-border: rgba(255, 255, 255, 0.1);
}

/* Themes Definition */
body.theme-sunny {
    --bg-gradient: linear-gradient(135deg, #f97316 0%, #f59e0b 50%, #eab308 100%);
    --card-bg: rgba(255, 255, 255, 0.15);
    --card-border: rgba(255, 255, 255, 0.25);
    --panel-bg: rgba(255, 255, 255, 0.1);
    --panel-border: rgba(255, 255, 255, 0.15);
    --accent: #fef08a;
}

body.theme-rainy {
    --bg-gradient: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1d4ed8 100%);
    --card-bg: rgba(15, 23, 42, 0.3);
    --card-border: rgba(255, 255, 255, 0.15);
    --panel-bg: rgba(255, 255, 255, 0.05);
    --panel-border: rgba(255, 255, 255, 0.08);
    --accent: #60a5fa;
}

body.theme-snowy {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #475569 50%, #94a3b8 100%);
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-border: rgba(255, 255, 255, 0.2);
    --panel-bg: rgba(255, 255, 255, 0.07);
    --panel-border: rgba(255, 255, 255, 0.12);
    --accent: #e2e8f0;
}

body.theme-stormy {
    --bg-gradient: linear-gradient(135deg, #090d16 0%, #1e1b4b 50%, #311042 100%);
    --card-bg: rgba(15, 23, 42, 0.45);
    --card-border: rgba(255, 255, 255, 0.1);
    --panel-bg: rgba(255, 255, 255, 0.04);
    --panel-border: rgba(255, 255, 255, 0.06);
    --accent: #c084fc;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    color: var(--text-color);
    transition: var(--theme-transition);
    padding: 20px;
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 760px;
    perspective: 1000px;
}

/* Glassmorphism Card styling */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: 30px;
    padding: 40px;
    box-shadow: var(--card-shadow);
    transition: var(--theme-transition);
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.city-name {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.city-name i {
    color: var(--accent);
}

.current-date {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.weather-status-badge {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* Weather Visual & Main Temp */
.weather-visual {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 20px 0;
    position: relative;
    min-height: 180px;
}

.temp-display {
    display: flex;
    align-items: flex-start;
}

.large-temp {
    font-size: 6.5rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -2px;
}

.temp-unit {
    font-size: 2.2rem;
    font-weight: 600;
    margin-top: 15px;
    color: var(--accent);
}

/* Animation Canvas */
.animation-container {
    position: relative;
    width: 150px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Weather Animations details */

/* 1. SUNNY */
.sunny-sun {
    position: absolute;
    width: 64px;
    height: 64px;
    background: radial-gradient(circle, #fef08a 0%, #f59e0b 80%, #d97706 100%);
    border-radius: 50%;
    box-shadow: 0 0 35px #f59e0b;
    animation: rotateSun 12s linear infinite;
}

.sunny-ray {
    position: absolute;
    width: 86px;
    height: 86px;
    border: 2px dashed rgba(254, 240, 138, 0.6);
    border-radius: 50%;
    animation: rotateSun 30s linear infinite reverse, pulseRay 3s ease-in-out infinite alternate;
}

@keyframes rotateSun {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulseRay {
    0% { transform: scale(0.95); opacity: 0.6; }
    100% { transform: scale(1.1); opacity: 0.95; }
}

/* 2. RAIN */
.cloud-base {
    position: absolute;
    width: 90px;
    height: 32px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 20px;
    filter: drop-shadow(0 8px 12px rgba(0,0,0,0.1));
    z-index: 2;
    animation: floatCloud 5s ease-in-out infinite alternate;
}

.cloud-base::before, .cloud-base::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
}

.cloud-base::before {
    width: 45px;
    height: 45px;
    top: -22px;
    left: 15px;
}

.cloud-base::after {
    width: 55px;
    height: 55px;
    top: -30px;
    right: 15px;
}

.rain-overlay {
    position: absolute;
    width: 80px;
    height: 60px;
    top: 90px;
    overflow: hidden;
}

.rain-drop {
    position: absolute;
    width: 2px;
    height: 12px;
    background: linear-gradient(transparent, #60a5fa);
    opacity: 0.7;
    animation: rainFall 1s linear infinite;
}

@keyframes rainFall {
    0% { transform: translateY(-20px); opacity: 0; }
    50% { opacity: 0.7; }
    100% { transform: translateY(60px); opacity: 0; }
}

@keyframes floatCloud {
    0% { transform: translateY(0) translateX(-5px); }
    100% { transform: translateY(-6px) translateX(5px); }
}

/* 3. SNOW */
.snow-flake {
    position: absolute;
    color: #ffffff;
    font-size: 1.2rem;
    opacity: 0;
    animation: snowDrift 2.5s linear infinite;
}

@keyframes snowDrift {
    0% { transform: translateY(-30px) translateX(0) rotate(0deg); opacity: 0; }
    30% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { transform: translateY(70px) translateX(15px) rotate(360deg); opacity: 0; }
}

/* 4. STORM / LIGHTNING */
.storm-cloud {
    background: rgba(71, 85, 105, 0.9);
}

.storm-cloud::before, .storm-cloud::after {
    background: rgba(71, 85, 105, 0.9);
}

.lightning-bolt {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 12px solid transparent;
    border-top: 25px solid #fbbf24;
    transform: skewX(-20deg);
    top: 85px;
    filter: drop-shadow(0 0 10px #fbbf24);
    animation: lightningFlash 4s ease-out infinite;
}

@keyframes lightningFlash {
    0%, 92%, 100% { opacity: 0; }
    93% { opacity: 1; }
    94% { opacity: 0.2; }
    96% { opacity: 1; }
}

/* Four Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.glass-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease;
}

.glass-panel:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.15);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    color: var(--accent);
}

.metric-details {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.metric-value {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 2px 0;
}

.metric-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Weather Selector Nav */
.weather-selector-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 25px;
}

.selector-title {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 600;
}

.selector-buttons {
    display: flex;
    gap: 12px;
}

.select-btn {
    flex: 1;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.select-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.select-btn.active {
    background: #ffffff;
    color: #0f172a;
    border-color: #ffffff;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .glass-card {
        padding: 24px;
        gap: 20px;
    }
    
    .card-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .weather-visual {
        flex-direction: column;
        gap: 20px;
        min-height: auto;
    }
    
    .large-temp {
        font-size: 5rem;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .selector-buttons {
        flex-wrap: wrap;
    }
    
    .select-btn {
        flex: calc(50% - 6px);
    }
}
