/**
 * WP PDC Meteo - Styles Frontend
 */

/* Container principal */
.wpmeteo-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 100%;
    margin: 1.5rem 0;
}

.wpmeteo-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: #1e293b;
}

.wpmeteo-subtitle {
    font-weight: 400;
    color: #64748b;
}

.wpmeteo-intro {
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.6;
    margin: 0 0 1rem 0;
    font-style: italic;
}

.wpmeteo-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Erreur */
.wpmeteo-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
}

/* ==========================================
   PRÉVISIONS 5 JOURS
   ========================================== */

.wpmeteo-forecast-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.wpmeteo-day {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem 0.5rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.wpmeteo-day:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wpmeteo-day--today {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #2563eb;
    color: white;
}

.wpmeteo-day--today .wpmeteo-day__name {
    color: rgba(255, 255, 255, 0.9);
}

.wpmeteo-day--today .wpmeteo-temp-min {
    color: rgba(255, 255, 255, 0.7);
}

.wpmeteo-day__name {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.wpmeteo-day__emoji {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.wpmeteo-day__temps {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.wpmeteo-temp-max {
    font-weight: 700;
    color: #1e293b;
}

.wpmeteo-day--today .wpmeteo-temp-max {
    color: white;
}

.wpmeteo-temp-min {
    color: #94a3b8;
}

.wpmeteo-day__rain {
    font-size: 0.75rem;
    color: #0ea5e9;
    margin-top: 0.25rem;
}

.wpmeteo-day--today .wpmeteo-day__rain {
    color: rgba(255, 255, 255, 0.9);
}

/* ==========================================
   CLIMAT MENSUEL (GRAPHIQUE + TABLEAU SEO)
   ========================================== */

.wpmeteo-climate {
    margin-top: 1rem;
}

/* --- Header avec toggle --- */
.wpmeteo-climate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.wpmeteo-climate-header .wpmeteo-section-title {
    margin: 0;
}

.wpmeteo-view-toggle {
    display: flex;
    gap: 0.25rem;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: 8px;
}

.wpmeteo-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.75rem;
    border: none !important;
    background: transparent !important;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b !important;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    font-family: inherit;
}

.wpmeteo-toggle-btn:hover {
    background: #e2e8f0 !important;
    color: #475569 !important;
}

.wpmeteo-toggle-btn--active,
.wpmeteo-toggle-btn--active:hover {
    background: white !important;
    color: #3b82f6 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* --- Gestion des vues --- */
.wpmeteo-view {
    display: none;
}

.wpmeteo-view--active {
    display: block;
}

/* --- Graphique interactif --- */
.wpmeteo-chart-wrapper {
    background: white;
    padding: 1rem;
}

.wpmeteo-chart-data {
    display: none;
}

/* Container scrollable */
.wpmeteo-chart-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.wpmeteo-chart-inner {
    min-width: 100%;
    height: 480px;
}

.wpmeteo-chart-inner canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Légende du graphique */
.wpmeteo-chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
}

.wpmeteo-legend-section {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.wpmeteo-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: #64748b;
}

/* Indicateur barre de température (dégradé bleu-rouge basé sur température) */
.wpmeteo-legend-bar {
    width: 16px;
    height: 12px;
    border-radius: 3px;
    background: linear-gradient(to top, rgba(59, 130, 246, 0.9), rgba(34, 197, 94, 0.9), rgba(234, 179, 8, 0.9), rgba(220, 38, 38, 0.9));
}

/* Indicateur ligne de précipitations */
.wpmeteo-legend-line {
    width: 20px;
    height: 3px;
    background: rgba(14, 165, 233, 1);
    border-radius: 2px;
    position: relative;
}

.wpmeteo-legend-line::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: rgba(14, 165, 233, 1);
    border-radius: 50%;
}

/* Points d'avis voyage */
.wpmeteo-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.wpmeteo-legend-dot--very-favorable {
    background: #16a34a;
}

.wpmeteo-legend-dot--favorable {
    background: #eab308;
}

.wpmeteo-legend-dot--unfavorable {
    background: #ea580c;
}

.wpmeteo-legend-dot--very-unfavorable {
    background: #dc2626;
}

/* --- Tableau SEO (caché visuellement) --- */
.wpmeteo-table-seo {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Ancien tableau (conservé pour référence) --- */
.wpmeteo-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.wpmeteo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wpmeteo-table th,
.wpmeteo-table td {
    padding: 0.75rem 1rem;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
}

.wpmeteo-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wpmeteo-table tbody tr:hover {
    background: #f8fafc;
}

.wpmeteo-table tbody tr:last-child td {
    border-bottom: none;
}

.wpmeteo-current-month {
    background: #eff6ff !important;
}

.wpmeteo-current-month td {
    font-weight: 600;
}

.wpmeteo-month-name {
    font-weight: 500;
    color: #1e293b;
}

.wpmeteo-temp {
    color: #475569;
    font-variant-numeric: tabular-nums;
}

.wpmeteo-rain {
    color: #0ea5e9;
    font-variant-numeric: tabular-nums;
}

.wpmeteo-weather {
    font-size: 1.25rem;
    text-align: center;
}

/* Avis voyage */
.wpmeteo-rating {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.05rem 0.5rem;
    border-radius: 9999px;
    display: inline-block !important;
    width: auto !important;
    white-space: nowrap;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.wpmeteo-rating--very-favorable {
    background: #16a34a;
}

.wpmeteo-rating--favorable {
    background: #eab308;
}

.wpmeteo-rating--unfavorable {
    background: #ea580c;
}

.wpmeteo-rating--very-unfavorable {
    background: #dc2626;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 640px) {
    .wpmeteo-forecast-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.25rem;
    }

    .wpmeteo-day {
        padding: 0.75rem 0.25rem;
        border-radius: 8px;
    }

    .wpmeteo-day__name {
        font-size: 0.65rem;
    }

    .wpmeteo-day__emoji {
        font-size: 1.5rem;
    }

    .wpmeteo-day__temps {
        flex-direction: column;
        gap: 0;
        font-size: 0.75rem;
    }

    .wpmeteo-day__rain {
        font-size: 0.65rem;
    }

    /* Graphique en mode mobile - scroll horizontal */
    .wpmeteo-chart-wrapper {
        padding: 0.75rem;
        position: relative;
        overflow: hidden;
    }

    .wpmeteo-chart-scroll {
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
        position: relative;
    }

    .wpmeteo-chart-inner {
        min-width: 700px; /* Force le scroll horizontal */
        height: 420px;
    }

    .wpmeteo-chart-legend {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .wpmeteo-legend-item {
        font-size: 0.65rem;
    }

    /* Conteneur pour le gradient fixe */
    .wpmeteo-chart-scroll {
        position: relative;
    }

    /* Indicateur de scroll (gradient sur le bord droit) */
    .wpmeteo-chart-wrapper::before {
        content: '';
        position: absolute;
        right: 0;
        top: 0.75rem;
        width: 40px;
        height: calc(100% - 80px); /* Exclure la légende */
        background: linear-gradient(to right, transparent, white);
        pointer-events: none;
        z-index: 10;
    }

    /* Tableau en mode mobile */
    .wpmeteo-table {
        font-size: 0.75rem;
    }

    .wpmeteo-table th,
    .wpmeteo-table td {
        padding: 0.5rem;
    }

    .wpmeteo-table th:nth-child(4),
    .wpmeteo-table td:nth-child(4) {
        display: none; /* Masquer la colonne pluie sur mobile */
    }

    .wpmeteo-rating {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
}

@media (max-width: 480px) {
    .wpmeteo-title {
        font-size: 1.25rem;
    }

    .wpmeteo-chart-inner {
        height: 300px;
    }

    .wpmeteo-table th:nth-child(2),
    .wpmeteo-table td:nth-child(2) {
        display: none; /* Masquer temp min sur très petit écran */
    }
}
