/* ── Weather Page Styles ── */

/* ── Select row (city picker) ── */
.weather-select-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.weather-select-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.weather-select-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
}
.weather-select-group select {
    padding: 0.55rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.95rem;
    min-width: 220px;
    cursor: pointer;
    transition: border-color .2s;
}
.weather-select-group select:focus {
    outline: none;
    border-color: var(--accent);
}
.weather-select-row .btn {
    margin-bottom: 0;
}

/* ── Current weather ── */
.weather-current {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2rem;
    align-items: center;
}
.weather-current-icon {
    font-size: 4rem;
    text-align: center;
    line-height: 1;
}
.weather-current-temp {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.2rem;
}
.weather-current-desc {
    font-size: 1.1rem;
    color: var(--muted);
}
.weather-current-location {
    font-size: 0.95rem;
    color: var(--muted);
    margin-top: 0.3rem;
}

/* ── Detail grid (2x3) ── */
.weather-details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}
.weather-detail-item {
    text-align: center;
    padding: 1rem;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: border-color .2s, transform .15s;
}
.weather-detail-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}
.weather-detail-icon {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}
.weather-detail-label {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.2rem;
}
.weather-detail-value {
    font-size: 1.2rem;
    font-weight: 600;
}

/* ── Sun info bar ── */
.sun-info-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.8rem 1rem;
    margin-top: 1.2rem;
    background: linear-gradient(135deg,
        rgba(255, 152, 0, .15) 0%,
        rgba(255, 235, 59, .1) 50%,
        rgba(33, 150, 243, .15) 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.95rem;
}
.sun-info-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ── Hourly table ── */
.weather-hourly-table {
    width: 100%;
    border-collapse: collapse;
}
.weather-hourly-table th,
.weather-hourly-table td {
    padding: 0.5rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.weather-hourly-table th {
    font-weight: 600;
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.weather-hourly-table tbody tr:hover {
    background: rgba(56, 189, 248, .05);
}
.weather-hourly-table .day-header {
    background: var(--surface);
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--accent);
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}
.weather-hourly-table .day-header:hover {
    background: rgba(56, 189, 248, .08);
}
.weather-hourly-table .day-header td {
    text-align: left;
    font-weight: 600;
}
.weather-hourly-table .day-header .day-toggle-chevron {
    display: inline-block;
    width: 1.2em;
    font-size: 0.75rem;
    color: var(--accent);
    transition: transform .2s;
}
.weather-hourly-table .day-header .day-summary {
    margin-left: 0.75rem;
    font-weight: 400;
    font-size: 0.82rem;
    color: var(--muted);
}
/* Accordion row visibility */
.weather-hourly-table .day-row-hidden {
    display: none;
}
.weather-hourly-table .day-header.day-open {
    border-bottom-color: var(--accent);
    background: rgba(56, 189, 248, .05);
}
.weather-hourly-table .weather-emoji {
    font-size: 1.2rem;
}

/* ── Chart container ── */
.weather-chart-container {
    position: relative;
    margin-top: 1.2rem;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
}
.weather-chart-container canvas {
    max-height: 320px;
}
.chart-legend {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
    justify-content: center;
}

/* ── Daily cards ── */
.daily-forecast-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.day-card {
    display: grid;
    grid-template-columns: 140px 60px 1fr;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: transform 0.15s, border-color .2s;
    cursor: default;
}
.day-card:hover {
    transform: translateX(4px);
    border-color: var(--accent);
}
.day-card-date {
    font-weight: 600;
    font-size: 0.95rem;
}
.day-card-icon {
    font-size: 1.8rem;
    text-align: center;
}
.day-card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.2rem;
    font-size: 0.88rem;
    color: var(--muted);
}
.day-card-temp {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}
.day-card-weather-text {
    font-size: 0.85rem;
    color: var(--accent);
}

/* ── Icon reference grid ── */
.weather-icons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}
.weather-icon-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: border-color .2s;
}
.weather-icon-card:hover {
    border-color: var(--accent);
}
.weather-icon-card .icon-emoji {
    font-size: 1.6rem;
}
.weather-icon-card .icon-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.weather-icon-card .icon-name {
    font-weight: 600;
    font-size: 0.9rem;
}
.weather-icon-card .icon-code {
    font-size: 0.75rem;
    color: var(--muted);
}

/* ── Loading indicator ── */
.weather-loading {
    display: none;
    text-align: center;
    padding: 3rem;
    color: var(--muted);
}
.weather-loading.active {
    display: block;
}
.weather-loading .spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Error state ── */
.weather-error {
    display: none;
    padding: 1.2rem;
    border-radius: 12px;
    background: rgba(239, 68, 68, .1);
    border: 1px solid rgba(239, 68, 68, .3);
    color: #ef4444;
    text-align: center;
}
.weather-error.active {
    display: block;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .weather-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .day-card {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .day-card-details {
        justify-content: center;
    }
    .weather-current {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .sun-info-bar {
        flex-direction: column;
        gap: 0.5rem;
    }
    .weather-select-row {
        flex-direction: column;
    }
    .weather-select-group select {
        min-width: 100%;
    }
    .weather-hourly-table th:nth-child(n+5),
    .weather-hourly-table td:nth-child(n+5) {
        display: none;
    }
}

@media (max-width: 420px) {
    .weather-details-grid {
        grid-template-columns: 1fr;
    }
    .weather-current-temp {
        font-size: 2.2rem;
    }
    .weather-current-icon {
        font-size: 3rem;
    }
}
