/**
 * Météo Centre - Frontend Ville CSS
 * @version 4.0.0 - Simplification complète
 *
 * Contenu : Layout spécifique bloc ville uniquement
 * Chargé : Uniquement si bloc mcpg/ville-meteo présent
 *
 * CHANGEMENTS v4.0:
 * ✅ Suppression des overrides de cards (héritées de core.css)
 * ✅ Layout en unités fluides (em/%)
 * ✅ Code drastiquement simplifié
 *
 * Typo héritée de WordPress, cards héritées de core.css
 */

/* ========================================================================
 * HEADER VILLE (Layout spécifique)
 * ======================================================================== */

.mcpg-ville-header {
    /* Hérite de .mcpg-header (core.css) pour le gradient */
}

.mcpg-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Centrage vertical des 2 blocs */
    gap: 1.25em; /* 1.875em → 1.25em */
    margin-bottom: 1.25em; /* 1.875em → 1.25em */
}

/* ✅ Layout 50/50 en desktop + Centrage des méta */
.mcpg-ville-info {
    flex: 1;
    max-width: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centrage vertical */
    align-items: center; /* Centrage horizontal */
    text-align: center;
}

.mcpg-ville-info h1 {
    margin-bottom: 0.25em;
}

.mcpg-ville-location,
.mcpg-ville-forecast-date {
    opacity: 0.9;
}

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

/* Météo actuelle (droite du header) - ✅ 50% en desktop */
.mcpg-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(--mcpg-radius);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25em; /* 1.875em → 1.25em */
    flex: 1;
    max-width: 50%;
}

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

/* ✅ Taille desktop : 8em = 128px à 16px de base */
.mcpg-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;
}

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

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

/* ✅ Badge température 8em = 128px en desktop */
.mcpg-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;
}

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

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

/* Cards 4 colonnes sous le header */
.mcpg-current-weather-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1em; /* 1.25em → 1em */
}

/* ✅ Ressenti : toujours full-width */
.mcpg-feels-like-card {
    grid-column: 1 / -1; /* Occupe toute la largeur */
    min-height: 8em; /* 8.75em → 8em */
    padding: 1em; /* 1.125em → 1em */
}

/* ✅ RESPONSIVE : Gestion des colonnes selon la largeur */
@media (max-width: 1024px) {
    .mcpg-current-weather-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .mcpg-feels-like-card {
        grid-column: 1 / -1; /* Toute la largeur */
    }
}

@media (max-width: 480px) {
    .mcpg-current-weather-cards {
        grid-template-columns: 1fr;
    }

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

.mcpg-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(--mcpg-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;
}

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

/* ✅ ENCART DÉDIÉ RESSENTI - Déjà défini plus haut avec grid-column: 1 / -1 */

.mcpg-feels-title {
    margin-bottom: 0.5em; /* Réduire encore */
}

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

.mcpg-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;
}

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

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

/* Responsive pour l'encart ressenti */
@media (max-width: 768px) {
    .mcpg-feels-like-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5em;
    }

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

    .mcpg-feels-title {
        margin-bottom: 0.375em; /* Réduire encore plus */
    }
}

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

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

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

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

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

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

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

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

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

/* === Résultats de recherche === */
.mcpg-search-results.active {
    display: block;
}

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

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

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

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

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

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

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

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

.mcpg-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(--mcpg-transition);
    margin-bottom: -2px;
}

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

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

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

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

/* ========================================================================
 * ONGLETS JOURS (Scroll horizontal)
 * ======================================================================== */

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

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

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

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

/* ========================================================================
 * FORECAST CARDS CONTAINER (Affichage par jour)
 * ======================================================================== */

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

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

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

/* ✅ SUPPRIMÉ : La grid hérite maintenant de .mcpg-hours-grid (core.css) */

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

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

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

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

.mcpg-chart-days-select {
    padding: 0.5em 2em 0.5em 0.75em;
    border: 2px solid var(--mcpg-border);
    border-radius: 6px;
    font-weight: 600;
    background: #fff;
    cursor: pointer;
    transition: var(--mcpg-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 */
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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