/* ===============================
   CSS CUSTOM PROPERTIES
================================= */
:root {
    --bg: #0F172A;
    --card: rgba(255, 255, 255, 0.8);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;
    --accent: #3B82F6;
    --accent-light: rgba(59, 130, 246, 0.15);
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    --radius: 24px;
    --radius-sm: 16px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ===============================
   RESET
================================= */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===============================
   BODY — Dynamic Weather Backgrounds
================================= */
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 1.2s ease, color 0.5s ease;
    overflow-x: hidden;
    position: relative;
}

/* Weather-specific body themes */
body.weather-clear {
    background: radial-gradient(circle at top right, #FDE68A 0%, #3B82F6 40%, #1E3A8A 100%);
}

body.weather-clear .card {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

body.weather-clouds {
    background: linear-gradient(135deg, #475569 0%, #1E293B 100%);
}

body.weather-clouds .card {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

body.weather-rain {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
    color: #F8FAFC;
}

body.weather-rain .card {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.weather-rain .card-title,
body.weather-rain .hero-city,
body.weather-rain .hero-temp,
body.weather-rain .hero-condition,
body.weather-rain .highlow-value,
body.weather-rain .forecast-day,
body.weather-rain .forecast-high,
body.weather-rain .hourly-temp,
body.weather-rain .detail-value {
    color: #FFFFFF;
}

body.weather-rain .subtitle,
body.weather-rain .hero-date,
body.weather-rain .hero-feels-like,
body.weather-rain .highlow-label,
body.weather-rain .detail-label,
body.weather-rain .hourly-time,
body.weather-rain .hourly-condition,
body.weather-rain .forecast-low,
body.weather-rain .detail-sub,
body.weather-rain .forecast-condition span {
    color: #B0BEC5;
}

body.weather-rain .header h1 {
    color: #FFFFFF;
}

body.weather-rain .current-location {
    color: #E0E0E0;
}

body.weather-rain .current-location svg {
    stroke: #80CBC4;
}

body.weather-rain .search-box {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

body.weather-rain .search-box input {
    color: #FFF;
}

body.weather-rain .search-box input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

body.weather-rain .search-box button {
    background: #80CBC4;
    color: #1A202C;
}

body.weather-rain .forecast-row {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.weather-rain .hero-temp-unit {
    color: #B0BEC5;
}

body.weather-rain .highlow-divider {
    background: rgba(255, 255, 255, 0.2);
}

body.weather-thunderstorm {
    background: linear-gradient(180deg, #1A1A2E 0%, #16213E 40%, #0F3460 100%);
    color: #E0E0E0;
}

body.weather-thunderstorm .card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.weather-thunderstorm .card-title,
body.weather-thunderstorm .hero-city,
body.weather-thunderstorm .hero-temp,
body.weather-thunderstorm .hero-condition,
body.weather-thunderstorm .highlow-value,
body.weather-thunderstorm .forecast-day,
body.weather-thunderstorm .forecast-high,
body.weather-thunderstorm .hourly-temp,
body.weather-thunderstorm .detail-value {
    color: #FFFFFF;
}

body.weather-thunderstorm .subtitle,
body.weather-thunderstorm .hero-date,
body.weather-thunderstorm .hero-feels-like,
body.weather-thunderstorm .highlow-label,
body.weather-thunderstorm .detail-label,
body.weather-thunderstorm .hourly-time,
body.weather-thunderstorm .hourly-condition,
body.weather-thunderstorm .forecast-low,
body.weather-thunderstorm .detail-sub,
body.weather-thunderstorm .forecast-condition span {
    color: #90A4AE;
}

body.weather-thunderstorm .header h1 {
    color: #FFFFFF;
}

body.weather-thunderstorm .current-location {
    color: #B0BEC5;
}

body.weather-thunderstorm .current-location svg {
    stroke: #FFD54F;
}

body.weather-thunderstorm .search-box {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

body.weather-thunderstorm .search-box input {
    color: #FFF;
}

body.weather-thunderstorm .search-box input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

body.weather-thunderstorm .search-box button {
    background: #FFD54F;
    color: #1A1A2E;
}

body.weather-thunderstorm .forecast-row {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.weather-thunderstorm .hero-temp-unit {
    color: #90A4AE;
}

body.weather-thunderstorm .highlow-divider {
    background: rgba(255, 255, 255, 0.15);
}

body.weather-snow {
    background: linear-gradient(135deg, #1E293B 0%, #334155 40%, #475569 100%);
}

body.weather-snow .card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

body.weather-drizzle {
    background: linear-gradient(180deg, #546E7A 0%, #607D8B 40%, #78909C 100%);
    color: #E0E0E0;
}

body.weather-drizzle .card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

body.weather-drizzle .card-title,
body.weather-drizzle .hero-city,
body.weather-drizzle .hero-temp,
body.weather-drizzle .hero-condition,
body.weather-drizzle .highlow-value,
body.weather-drizzle .forecast-day,
body.weather-drizzle .forecast-high,
body.weather-drizzle .hourly-temp,
body.weather-drizzle .detail-value {
    color: #FFFFFF;
}

body.weather-drizzle .subtitle,
body.weather-drizzle .hero-date,
body.weather-drizzle .hero-feels-like,
body.weather-drizzle .highlow-label,
body.weather-drizzle .detail-label,
body.weather-drizzle .hourly-time,
body.weather-drizzle .hourly-condition,
body.weather-drizzle .forecast-low,
body.weather-drizzle .detail-sub,
body.weather-drizzle .forecast-condition span {
    color: #B0BEC5;
}

body.weather-drizzle .header h1 {
    color: #FFFFFF;
}

body.weather-drizzle .current-location {
    color: #E0E0E0;
}

body.weather-drizzle .search-box {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

body.weather-drizzle .search-box input {
    color: #FFF;
}

body.weather-drizzle .search-box input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

body.weather-drizzle .search-box button {
    background: #80DEEA;
    color: #1A202C;
}

body.weather-drizzle .forecast-row {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.weather-drizzle .hero-temp-unit {
    color: #B0BEC5;
}

body.weather-drizzle .highlow-divider {
    background: rgba(255, 255, 255, 0.2);
}

body.weather-mist,
body.weather-haze,
body.weather-fog {
    background: linear-gradient(180deg, #90A4AE 0%, #B0BEC5 40%, #CFD8DC 100%);
}

body.weather-mist .card,
body.weather-haze .card,
body.weather-fog .card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ===============================
   WEATHER EFFECTS LAYER
================================= */
.weather-effects {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.effect-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.lightning-flash {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, #FFF 0%, rgba(255, 255, 255, 0.8) 50%, transparent 100%);
    opacity: 0;
    mix-blend-mode: overlay;
    transition: opacity 0.03s ease-out;
}

.sunny-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 70% 60% at 85% 15%,
            rgba(255, 243, 191, 0.6) 0%,
            rgba(255, 236, 153, 0.3) 30%,
            transparent 80%);
    animation: sunPulse 8s ease-in-out infinite;
    mix-blend-mode: screen;
}

.sunny-overlay::before {
    content: '';
    position: absolute;
    top: -100px;
    right: 50px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.5) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(40px);
    animation: sunGlow 5s ease-in-out infinite alternate;
}

.sunny-overlay::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 120px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(255, 235, 59, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: sunGlow 3s ease-in-out infinite alternate-reverse;
}

@keyframes sunPulse {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }
}

@keyframes sunGlow {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.3);
        opacity: 1;
    }
}

.hidden {
    display: none !important;
}

/* ===============================
   DASHBOARD CONTAINER
================================= */
.dashboard {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 60px;
    position: relative;
    z-index: 2;
}

/* ===============================
   HEADER
================================= */
.header {
    margin-bottom: 24px;
}

.header h1 {
    font-size: 40px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1.5px;
    line-height: 1.1;
    text-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    transition: color 0.5s ease;
}

.subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-top: 8px;
    font-weight: 400;
    opacity: 0.8;
    transition: color 0.5s ease;
}

/* ===============================
   SEARCH ROW
================================= */
.search-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 20px;
}

.current-location {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.5s ease;
}

.current-location svg {
    stroke: var(--accent);
    transition: stroke 0.5s ease;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    padding: 6px 6px 6px 20px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-box:focus-within {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2), var(--shadow-lg);
    background: rgba(255, 255, 255, 0.12);
}

.search-icon {
    flex-shrink: 0;
    margin-right: 8px;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    font-family: var(--font);
    color: var(--text-primary);
    background: transparent;
    padding: 8px 0;
    transition: color 0.5s ease;
}

.search-box input::placeholder {
    color: var(--text-tertiary);
    transition: color 0.5s ease;
}

.search-box button {
    padding: 12px 28px;
    border-radius: 50px;
    border: none;
    background: #FFFFFF;
    color: #0F172A;
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.search-box button:hover {
    background: #F8FAFC;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 255, 255, 0.2);
}

.search-box button:active {
    transform: scale(0.95);
}

/* ===============================
   ERROR MESSAGE
================================= */
.error-message {
    background: rgba(229, 62, 62, 0.1);
    color: #E53E3E;
    padding: 16px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    margin-bottom: 20px;
    border: 1px solid rgba(229, 62, 62, 0.2);
}

/* ===============================
   CARDS (SHARED)
================================= */
.card {
    background: var(--card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 28px 32px;
    border: 1px solid var(--border);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.25);
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    letter-spacing: -0.3px;
    transition: color 0.5s ease;
}

/* ===============================
   HERO WEATHER CARD
================================= */
.hero-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding: 32px 40px;
}

.hero-left {
    flex: 1;
}

.hero-city {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    transition: color 0.5s ease;
}

.hero-date {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 400;
    transition: color 0.5s ease;
}

.hero-temp-row {
    display: flex;
    align-items: flex-start;
    margin-top: 16px;
    gap: 2px;
}

.hero-temp {
    font-size: 80px;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
    letter-spacing: -3px;
    transition: color 0.5s ease;
}

.hero-temp-unit {
    font-size: 28px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 10px;
    transition: color 0.5s ease;
}

.hero-condition {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 8px;
    transition: color 0.5s ease;
}

.hero-feels-like {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
    transition: color 0.5s ease;
}

.hero-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 24px;
}

.hero-icon-container {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-icon-container svg {
    width: 100%;
    height: 100%;
}

.hero-highlow {
    display: flex;
    align-items: center;
    gap: 16px;
}

.highlow-item {
    text-align: center;
}

.highlow-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.5s ease;
}

.highlow-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2px;
    transition: color 0.5s ease;
}

.highlow-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
    transition: background 0.5s ease;
}

/* ===============================
   MIDDLE ROW (Hourly + Details)
================================= */
.middle-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* ===============================
   HOURLY FORECAST
================================= */
.hourly-card {
    overflow: hidden;
}

#hourlyChart {
    width: 100%;
    height: 200px;
    margin-bottom: 20px;
}

.hourly-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    text-align: center;
}

.hourly-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 4px;
}

.hourly-time {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.5s ease;
}

.hourly-temp {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    transition: color 0.5s ease;
}

.hourly-condition {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
    transition: color 0.5s ease;
}

.hourly-icon svg {
    width: 24px;
    height: 24px;
}

/* ===============================
   WEATHER DETAILS
================================= */
.details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.detail-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.detail-icon svg {
    width: 28px;
    height: 28px;
}

.detail-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.5s ease;
}

.detail-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    transition: color 0.5s ease;
}

.detail-sub {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.5s ease;
}

/* ===============================
   7-DAY FORECAST
================================= */
.forecast-list {
    display: flex;
    flex-direction: column;
}

.forecast-row {
    display: grid;
    grid-template-columns: 120px 140px 80px 50px 120px 50px;
    align-items: center;
    padding: 14px 8px;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    transition: border-color 0.5s ease;
}

.forecast-row:last-child {
    border-bottom: none;
}

.forecast-day {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.5s ease;
}

.forecast-condition {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.5s ease;
}

.forecast-condition svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.forecast-precip {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
    justify-self: center;
}

.forecast-precip svg {
    width: 14px;
    height: 14px;
}

.forecast-low {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
    transition: color 0.5s ease;
}

.forecast-bar-container {
    width: 100%;
    min-width: 80px;
    height: 8px;
    min-height: 8px;
    background: #E2E8F0;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    align-self: center;
}

.forecast-bar {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 4px;
    min-width: 10px;
    background: linear-gradient(90deg, #60A5FA, #F59E0B);
    transition: width 0.5s ease, left 0.5s ease;
}

.forecast-high {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    transition: color 0.5s ease;
}

/* ===============================
   SPINNER
================================= */
.spinner {
    display: flex;
    justify-content: center;
    padding: 60px 0;
}

.spinner-circle {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===============================
   ANIMATIONS
================================= */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

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

.card.show {
    animation: fadeInUp 0.5s ease forwards;
}

/* ===============================
   RESPONSIVE
================================= */
@media (max-width: 900px) {
    .middle-row {
        grid-template-columns: 1fr;
    }

    .forecast-row {
        grid-template-columns: 80px 120px 70px 40px 100px 40px;
        gap: 10px;
    }
}

@media (max-width: 600px) {
    .dashboard {
        padding: 24px 16px 40px;
    }

    .header h1 {
        font-size: 24px;
    }

    .search-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-box {
        max-width: 100%;
    }

    .hero-card {
        flex-direction: column;
        padding: 24px;
        gap: 20px;
    }

    .hero-right {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    .hero-temp {
        font-size: 56px;
    }

    .hourly-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .details-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .forecast-row {
        grid-template-columns: 60px 1fr 40px;
        gap: 8px;
    }

    .forecast-condition,
    .forecast-precip,
    .forecast-bar-container {
        display: none;
    }
}