:root {
    --bg-color: #f0f4f8;
    --surface-color: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --accent-color: #3182ce;
    --accent-light: #ebf8ff;
    --border-color: #e2e8f0;
    --danger-bg: #fff5f5;
    --danger-text: #c53030;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    padding: 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.top-bar {
    background-color: var(--surface-color);
    color: var(--text-primary);
    padding: 10px 15px;
    border-radius: var(--radius);
    margin-bottom: 15px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.top-bar h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
    margin: 0;
    letter-spacing: 0.5px;
}

.top-bar .coords {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media (min-width: 900px) {
    .dashboard {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto auto auto;
        align-items: stretch;
    }
    #current-conditions { grid-row: 1; }
    #hourly-forecast { grid-row: 2; }
    #radar { grid-row: 3; }
    #daily-forecast { grid-row: 4; }
    #historical-divider { grid-row: 5; }
    #historical-graphs { grid-row: 6; }
    #precip-graphs { grid-row: 7; }
}

.section-divider {
    margin-top: 20px;
    margin-bottom: 5px;
    text-align: center;
}

.section-divider h2 {
    color: var(--accent-color);
    font-size: 1.4rem;
    border-bottom: none;
    margin-bottom: 5px;
    padding-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.section-divider hr {
    border: none;
    height: 2px;
    background-color: var(--border-color);
    width: 100%;
}

.panel {
    background-color: var(--surface-color);
    border-radius: var(--radius);
    padding: 15px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

h2 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 6px;
}

/* Data Grid for Current Conditions */
.data-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    flex: 1;
}

@media (max-width: 600px) {
    .data-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.data-box {
    background-color: var(--accent-light);
    border-radius: 8px;
    padding: 15px 10px;
    text-align: center;
    border: 1px solid #bee3f8;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.data-box .label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.data-box .value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Loaders and Hidden */
.hidden { display: none !important; }
.loader {
    font-weight: 500;
    color: var(--accent-color);
    margin: 15px 0;
    text-align: center;
}

/* Radar */
.radar-container {
    width: 100%;
    height: 900px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    flex: 1;
}
.radar-container iframe {
    width: 100%;
    height: 100%;
}

/* Hourly Horizontal Scroll */
.hourly-scroll-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--surface-color);
    width: 100%;
    flex: 1;
}

.hourly-scroll-wrapper::-webkit-scrollbar {
    height: 8px;
}

.hourly-scroll-wrapper::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 0 0 var(--radius) var(--radius);
}

.hourly-scroll-wrapper::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
}

.hourly-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.hourly-header {
    display: flex;
    background-color: var(--bg-color);
    height: 100%;
}

.hourly-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 2px;
    border-right: 1px dashed var(--border-color);
    position: relative;
    min-width: 65px;
}

.hourly-col:last-child { border-right: none; }

.hourly-time {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.hourly-icon {
    width: 35px;
    height: 35px;
    object-fit: contain;
    margin-bottom: 6px;
}

.hourly-wind {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-align: center;
    white-space: nowrap;
}

.hourly-lightning {
    width: 100%;
    text-align: center;
    font-size: 0.85rem;
    padding: 2px 0;
    border-radius: 4px;
    min-height: 22px;
}

.hourly-lightning.risk {
    background-color: var(--danger-bg);
    color: var(--danger-text);
    animation: softPulse 2.5s infinite;
}

/* Tables */
.table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 450px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    white-space: nowrap;
}

th {
    background-color: var(--bg-color);
    color: var(--text-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover td {
    background-color: #f7fafc;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 260px;
    width: 100%;
    margin-bottom: 10px;
}
.chart-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Methodology */
.methodology {
    margin-top: 20px;
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding: 0 10px;
}
.methodology h2 {
    border-bottom: none;
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.methodology p {
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}