/* ================================== */
/* 1. Theme Variables and Base Reset */
/* ================================== */

:root {
    /* Brand Colors: The "Sharp" Palette */
    --bg-color: #F7F9FC;
    /* Paper White */
    --card-bg: #ffffff;
    --text-color: #1C2129;
    /* Midnight Navy (Main Text) */
    --secondary-text: #1F3455;

    --primary-color: #243456;
    /* Navy for Headers/Borders */
    --accent-color: #FDCB6E;
    /* Lightning Gold for Actions/Highlights */
    --cloud-blue: #DDECF9;
    /* Secondary Backgrounds */

    /* Functional */
    --shadow-color: rgba(36, 52, 86, 0.15);
    /* Navy shadow */
    --border-color: #243456;
    /* The "Sticker" Border */
}

.dark {
    /* Dark Mode Overrides */
    --bg-color: #1A2639;
    /* Deep Dark Blue */
    --card-bg: #243456;
    /* Lighter Navy */
    --text-color: #F7F9FC;
    /* White text */
    --secondary-text: #DDECF9;

    --primary-color: #FDCB6E;
    /* Gold becomes primary text accent */
    --border-color: #4B5563;
    /* Darker border for contrast */
}

/* --- Dark Mode Polyfills (Build Fix) --- */
.dark .dark\:hidden {
    display: none !important;
}

.dark .dark\:block {
    display: block !important;
}

/* Widget Gradients in Dark Mode */
.dark #wind-widget,
.dark #humidity-widget {
    background-image: linear-gradient(to bottom right, #1f2937, #111827) !important;
}

/* * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
} REMOVED TO PREVENT CONFLICT WITH TAILWIND PREFLIGHT */

body {
    font-family: 'Nunito', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    padding: 20px;
    min-height: 100vh;
    line-height: 1.6;
}

/* ================================== */
/* 2. Layout and Widgets */
/* ================================== */

/* Widget Styling: The "Chunky Sticker" Look */
.widget {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    border: 2px solid var(--border-color);
    box-shadow: 4px 4px 0px var(--shadow-color);
    /* Hard shadow for "pop" */
    transition: transform 0.2s, box-shadow 0.2s;
}

.widget:hover {
    transform: translateY(-2px);
    box-shadow: 6px 6px 0px var(--shadow-color);
}

/* --- Specific Widget Layouts --- */

.main-condition {
    text-align: center;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.large-text {
    font-size: 5em;
    font-weight: 300;
    line-height: 1;
    margin: 10px 0;
    color: var(--primary-color);
}

/* Info Grid Text */
.info-box h4 {
    color: var(--secondary-text);
    margin-bottom: 5px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ================================== */
/* 3. Forecast Components */
/* ================================== */

/* Hourly Scroll Container */
.scroll-container {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding: 10px 0;
    margin-top: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--card-bg);
}

.scroll-container::-webkit-scrollbar {
    height: 8px;
}

.scroll-container::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 4px;
}

.hourly-item {
    flex-shrink: 0;
    text-align: center;
    padding: 10px;
    border-radius: 12px;
    min-width: 80px;
    /* Inner cards get a subtle border too */
    border: 1px solid var(--border-color);
}

/* Daily List */
.daily-item {
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
}

.daily-item:last-child {
    border-bottom: none;
}

.daily-item .high {
    font-weight: bold;
    color: var(--primary-color);
}

/* ================================== */
/* 4. Controls and Footer */
/* ================================== */

.settings-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--card-bg);
    border-top: 2px solid var(--border-color);
    padding: 15px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    z-index: 10;
}

/* Favorites Menu */
.favorites-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    list-style: none;
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 2px solid var(--border-color);
    box-shadow: 4px 4px 0px var(--shadow-color);
    padding: 5px 0;
    min-width: 200px;
    z-index: 9;
}

.favorite-item:hover {
    background-color: var(--bg-color);
}

/* ================================== */
/* 5. Modal Styling */
/* ================================== */

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(36, 52, 86, 0.8);
    /* Navy overlay */
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 16px;
    border: 2px solid var(--border-color);
    box-shadow: 8px 8px 0px var(--shadow-color);
    width: 90%;
    max-width: 400px;
    color: var(--text-color);
}

.hidden {
    display: none;
}

/* ================================== */
/* 6. Alerts and Rain Visualizer      */
/* ================================== */

/* Active Alerts Banner */
#alerts-container {
    margin-bottom: 20px;
}

.alert-banner {
    background-color: #e53e3e; /* Red-600 */
    color: white;
    padding: 15px;
    border-radius: 12px;
    border: 2px solid #742a2a; /* Red-900 */
    box-shadow: 4px 4px 0px rgba(0,0,0,0.2);
    margin-bottom: 10px;
    animation: fadeIn 0.5s ease;
}

.alert-banner h4 {
    font-weight: 900;
    text-transform: uppercase;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.alert-banner p {
    font-size: 0.95em;
    opacity: 0.95;
}

/* Rain Bars (Inside Hourly Item) */
.hourly-item {
    position: relative;
    overflow: hidden; /* clip the bar */
}

.rain-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(59, 130, 246, 0.3); /* Blue-500 @ 30% */
    z-index: 0; /* Behind text */
    transition: height 0.5s ease;
    border-top: 2px solid rgba(59, 130, 246, 0.5);
}

/* Ensure text is above the rain bar */
.hourly-item > * {
    position: relative;
    z-index: 1;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}