/**
 * Météo Centre - Frontend City CSS
 * @version 4.0.0 - Complete simplification
 *
 * Contents: City block-specific layout only
 * Loaded: Only when the rsmc/city-forecast block is present
 *
 * CHANGES v4.0:
 * ✅ Removal of card overrides (inherited from core.css)
 * ✅ Layout in fluid units (em/%)
 * ✅ Drastically simplified code
 *
 * Typography inherited from WordPress, cards inherited from core.css
 */

/* ========================================================================
 * CITY HEADER (Specific layout)
 * ======================================================================== */

.rsmc-city-header {
    /* Inherits from .rsmc-header (core.css) for the gradient */
}

.rsmc-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Vertically centres both blocks */
    gap: 1.25em; /* 1.875em → 1.25em */
    margin-bottom: 1.25em; /* 1.875em → 1.25em */
}

/* ✅ 50/50 layout on desktop + meta centring */
.rsmc-city-info {
    flex: 1;
    max-width: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Vertical centring */
    align-items: center; /* Horizontal centring */
    text-align: center;
}

.rsmc-city-info h1 {
    margin-bottom: 0.25em;
}

.rsmc-city-location,
.rsmc-city-forecast-date {
    opacity: 0.9;
}

.rsmc-city-forecast-date {
    font-style: italic;
    margin-top: 0.25em; /* 0.5em → 0.25em */
}

/* Current weather (right side of header) - ✅ 50% on desktop */
.rsmc-current-weather-main {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 1em 1.25em; /* 1.25em 1.5625em → 1em 1.25em */
    border-radius: var(--rsmc-radius);
    display: flex;
    justify-content: center;
    /* Top-align the two columns so the sky picto & temperature circle sit at the same
       height — and the sky description lines up with the "feels like" text below them. */
    align-items: flex-start;
    gap: 1.25em; /* 1.875em → 1.25em */
    flex: 1;
    max-width: 50%;
}

/* Equal-height picto / temperature columns so their captions align. */
.rsmc-weather-picto-group,
.rsmc-temp-group {
    flex: 1;
    min-width: 0;
}

.rsmc-weather-picto-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75em;
    justify-content: center;
}

/* ✅ Desktop size: 8em = 128px at 16px base */
.rsmc-weather-main-picto {
    width: 8em;
    height: 8em;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    cursor: help;
}

.rsmc-weather-desc-main {
    opacity: 0.9;
    font-weight: 500;
    text-align: center;
    font-size: 1em;
}

.rsmc-temp-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75em;
    justify-content: center;
}

/* ✅ Temperature badge 8em = 128px on desktop */
.rsmc-temp-main-badge svg {
    width: 8em !important;
    max-width: 100% !important;
    height: auto !important;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
    cursor: help;
}

.rsmc-temp-main-badge {
    cursor: help;
}

.rsmc-temp-feels-text {
    opacity: 0.9;
    font-weight: 500;
    text-align: center;
    font-size: 0.9375em;
}

/* 4-column cards below the header */
.rsmc-current-weather-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1em; /* 1.25em → 1em */
}

/* ✅ Feels-like: always full-width */
.rsmc-feels-like-card {
    grid-column: 1 / -1; /* Spans full width */
    min-height: 8em; /* 8.75em → 8em */
    padding: 1em; /* 1.125em → 1em */
}

/* ✅ RESPONSIVE: Column management by width */
@media (max-width: 1024px) {
    .rsmc-current-weather-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .rsmc-feels-like-card {
        grid-column: 1 / -1; /* Full width */
    }
}

@media (max-width: 480px) {
    .rsmc-current-weather-cards {
        grid-template-columns: repeat(2, 1fr); /* 2×2 — there is room, don't stack 1×4 */
    }

    .rsmc-feels-like-card {
        grid-column: 1 / -1;
    }
}

.rsmc-weather-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 1em; /* 1.25em → 1em */
    border-radius: 10px;
    text-align: center;
    transition: var(--rsmc-transition);
    min-height: 7em; /* 7.5em → 7em */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.25em; /* 0.5em → 0.25em */
    cursor: help;
    user-select: none;
}

.rsmc-weather-card:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px);
}

/* ✅ DEDICATED FEELS-LIKE BLOCK - Already defined above with grid-column: 1 / -1 */

.rsmc-feels-title {
    margin-bottom: 0.5em; /* Reduce further */
}

.rsmc-feels-like-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.625em;
    width: 100%;
}

.rsmc-feels-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25em;
    padding: 0.5em;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: help;
    user-select: none;
}

.rsmc-feels-label {
    font-size: 0.6875em; /* 11px */
    opacity: 0.85;
    font-weight: 600;
    text-transform: uppercase;
}

.rsmc-feels-value {
    font-size: 1.125em; /* 18px */
    font-weight: 700;
    line-height: 1;
}

/* Responsive for the feels-like block */
@media (max-width: 768px) {
    .rsmc-feels-like-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5em;
    }

    .rsmc-feels-value {
        font-size: 1em; /* 16px relative */
    }

    .rsmc-feels-title {
        margin-bottom: 0.375em; /* Reduce even further */
    }
}

.rsmc-card-icon {
    font-size: 1.75em; /* 28px */
}

.rsmc-card-picto {
    width: 2em; /* 32px */
    height: 2em;
    object-fit: contain;
}

.rsmc-card-value {
    font-weight: 700;
    line-height: 1.2;
}

.rsmc-card-label {
    opacity: 0.9;
    font-weight: 500;
}

/* ========================================================================
 * BARRE DE RECHERCHE
 * ======================================================================== */

.rsmc-search-bar {
    position: relative;
    margin-bottom: 1.25em;
}

.rsmc-city-search {
    width: 100%;
    padding: 0.875em 1.25em;
    border: 2px solid var(--rsmc-border);
    border-radius: var(--rsmc-radius-sm);
    font-size: 1em;
    transition: var(--rsmc-transition);
}

.rsmc-city-search:focus {
    outline: none;
    border-color: var(--rsmc-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.rsmc-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid var(--rsmc-border);
    border-top: none;
    border-radius: 0 0 var(--rsmc-radius-sm) var(--rsmc-radius-sm);
    max-height: 18.75em; /* 300px */
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: var(--rsmc-shadow);
}

/* === Search results === */
.rsmc-search-results.active {
    display: block;
}

.rsmc-search-item {
    padding: 0.75em 1em;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--rsmc-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rsmc-search-item:hover {
    background: var(--rsmc-light);
}

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

.rsmc-search-name {
    font-weight: 600;
    color: var(--rsmc-dark);
}

.rsmc-search-name mark {
    background: rgba(102, 126, 234, 0.2);
    color: var(--rsmc-primary);
    font-weight: 700;
    padding: 0 0.125em;
}

.rsmc-search-postal {
    font-size: 0.8125em; /* 13px */
    font-weight: 700;
    color: var(--rsmc-primary);
    background: rgba(102, 126, 234, 0.1);
    padding: 0.125em 0.5em;
    border-radius: 4px;
}

/* ========================================================================
 * TABS (Cards / Vue Tableau)
 * ======================================================================== */

.rsmc-forecast-tabs {
    display: flex;
    gap: 0.625em;
    margin-bottom: 1.25em;
    border-bottom: 2px solid var(--rsmc-border);
    padding-bottom: 0;
}

.rsmc-tab-btn {
    padding: 0.75em 1.25em;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: var(--rsmc-transition);
    margin-bottom: -2px;
}

.rsmc-tab-btn:hover {
    color: var(--rsmc-primary);
}

.rsmc-tab-btn.active {
    color: var(--rsmc-primary);
    border-bottom-color: var(--rsmc-primary);
}

.rsmc-tab-content {
    display: none;
}

.rsmc-tab-content.active {
    display: block;
}

/* ========================================================================
 * DAY TABS (Horizontal scroll)
 * ======================================================================== */

.rsmc-days-tabs {
    display: flex;
    gap: 0.5em;
    margin-bottom: 1.25em;
    overflow-x: auto;
    padding-bottom: 0.5em;
}

.rsmc-day-tab,
.rsmc-table-day-tab {
    padding: 0.625em 1em;
    background: var(--rsmc-light);
    border: 2px solid transparent;
    border-radius: var(--rsmc-radius-sm);
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: var(--rsmc-transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.rsmc-day-tab:hover,
.rsmc-table-day-tab:hover {
    background: #e3e8f0;
    color: var(--rsmc-primary);
}

.rsmc-day-tab.active,
.rsmc-table-day-tab.active {
    background: var(--rsmc-primary);
    color: #fff;
    border-color: var(--rsmc-primary);
}

/* ========================================================================
 * FORECAST CARDS CONTAINER (Per-day display)
 * ======================================================================== */

.rsmc-forecast-cards-container {
    display: block;
    width: 100%;
}

.rsmc-day-section {
    display: none;
    width: 100%;
}

.rsmc-day-section.active {
    display: block;
}

/* ✅ REMOVED: The grid now inherits from .rsmc-hours-grid (core.css) */

/* ========================================================================
 * GRAPHIQUES
 * ======================================================================== */

.rsmc-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.25em;
    margin-bottom: 1.25em;
    flex-wrap: wrap;
}

.rsmc-chart-period-selector {
    display: flex;
    align-items: center;
    gap: 0.625em;
    padding: 0.75em 1em;
    background: var(--rsmc-light);
    border-radius: var(--rsmc-radius-sm);
}

.rsmc-chart-period-selector label {
    font-weight: 600;
    white-space: nowrap;
}

.rsmc-chart-days-select {
    padding: 0.5em 2em 0.5em 0.75em;
    border: 2px solid var(--rsmc-border);
    border-radius: 6px;
    font-weight: 600;
    background: #fff;
    cursor: pointer;
    transition: var(--rsmc-transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23333' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625em center;
    min-width: 7.5em; /* 120px */
}

.rsmc-chart-days-select:focus {
    outline: none;
    border-color: var(--rsmc-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.rsmc-chart-days-select:hover {
    border-color: var(--rsmc-primary);
}

.rsmc-chart-controls {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.9375em;
    flex-wrap: wrap;
}

.rsmc-chart-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625em;
}

.rsmc-metric-checkbox {
    display: flex;
    align-items: center;
    gap: 0.375em;
    padding: 0.5em 0.75em;
    background: var(--rsmc-light);
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--rsmc-transition);
    font-size: inherit;
    font-weight: inherit;
    font-family: inherit;
}

.rsmc-metric-checkbox:hover {
    background: #e3e8f0;
}

.rsmc-metric-checkbox:has(input:checked) {
    background: rgba(102, 126, 234, 0.1);
    border-color: var(--rsmc-primary);
}

.rsmc-chart-container {
    position: relative;
    height: 25em; /* 400px relatif */
    background: var(--rsmc-light);
    border-radius: 10px;
    padding: 1.25em;
}

.rsmc-chart-container canvas {
    max-height: 100%;
}

/* ========================================================================
 * TABLEAU
 * ======================================================================== */

.rsmc-table-wrapper {
    overflow-x: auto;
}

.rsmc-table-day-section {
    display: none;
}

.rsmc-table-day-section.active {
    display: block;
}

.rsmc-forecast-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.rsmc-forecast-table thead {
    background: var(--rsmc-light);
}

.rsmc-forecast-table th {
    padding: 0.75em 0.625em;
    text-align: left;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    border-bottom: 2px solid var(--rsmc-border);
}

.rsmc-forecast-table td {
    padding: 0.75em 0.625em;
    border-bottom: 1px solid var(--rsmc-border);
}

.rsmc-forecast-table tbody tr:hover {
    background: var(--rsmc-light);
}

.rsmc-table-icon {
    width: 2em; /* 32px */
    height: 2em;
    object-fit: contain;
    vertical-align: middle;
}

/* ========================================================================
 * MIN/MAX TEMPERATURES (header + day tabs)
 * ======================================================================== */

/* Readable chips (solid background so red/blue stay legible on the header gradient). */
.rsmc-temp-minmax {
    display: flex;
    gap: 0.4em;
    justify-content: center;
    margin-top: 0.35em;
}

.rsmc-temp-minmax .rsmc-tmax,
.rsmc-temp-minmax .rsmc-tmin {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 999px;
    padding: 0.1em 0.55em;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.rsmc-tmax { color: #d9480f; }
.rsmc-tmin { color: #1971c2; }

/* Subtle compute/run notice directly under the header (hover/tap → full details). */
.rsmc-data-notice {
    text-align: center;
    font-size: 0.78em;
    opacity: 0.6;
    margin: 0.5em 0 0;
    cursor: help;
    font-variant-numeric: tabular-nums;
}

.rsmc-data-notice:hover {
    opacity: 0.9;
}

/* One-line dominant-weather day summary under the header. */
.rsmc-day-summary {
    display: flex;
    align-items: flex-start;
    gap: 0.6em;
    margin: 0.75em 0 0.5em;
    color: var(--rsmc-text, #2b2f38);
}

.rsmc-day-summary-icon {
    width: 2.2em;
    height: 2.2em;
    object-fit: contain;
    flex-shrink: 0;
}

.rsmc-day-summary-text {
    display: flex;
    flex-direction: column;
    gap: 0.1em;
}

.rsmc-day-summary-title {
    font-weight: 700;
    font-size: 1.02em;
}

.rsmc-day-summary-text > span {
    font-weight: 400;
    line-height: 1.4;
}

/* Accessibility — "Listen" (text-to-speech) button under the day summary. */
.rsmc-tts-btn {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    margin-top: 0.4em;
    padding: 0.25em 0.7em;
    font-size: 0.85em;
    font-weight: 600;
    line-height: 1.3;
    color: var(--rsmc-accent, #2563eb);
    background: var(--rsmc-accent-soft, rgba(37, 99, 235, 0.08));
    border: 1px solid var(--rsmc-accent, #2563eb);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.rsmc-tts-btn:hover,
.rsmc-tts-btn:focus-visible {
    color: #fff;
    background: var(--rsmc-accent, #2563eb);
}

.rsmc-tts-btn.rsmc-tts-playing {
    color: #fff;
    background: var(--rsmc-accent, #2563eb);
}

.rsmc-tts-icon {
    font-size: 1.05em;
    line-height: 1;
}

/* Day tabs now carry a dominant icon + min/max. */
.rsmc-day-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    line-height: 1.15;
}

.rsmc-day-tab-icon {
    width: 1.9em;
    height: 1.9em;
    object-fit: contain;
}

.rsmc-day-tab-temps {
    font-size: 0.78em;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.rsmc-day-tab .rsmc-tmax { color: #d9480f; }
.rsmc-day-tab .rsmc-tmin { color: #1971c2; }

.rsmc-day-tab.active .rsmc-tmax,
.rsmc-day-tab.active .rsmc-tmin {
    color: #fff;
}

/* (The compact card layout rules moved to frontend-core.css so the map's 7-day modal
 * — which loads core, not this file — can use them too.) */
