/* ==================== Global ==================== */
body {
    background-color: #f0f0f0;
    color: #333;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
}

.card {
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 0px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover, .hover-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

.card h2 { font-size: 2rem; margin:10px 0; }
.card h5 { font-size: 1.1rem; margin-bottom:5px; }

.text-primary { color: #4da6ff !important; }
.text-danger { color: #ff4d4d !important; }

.temp-min { color: #81d4fa !important; font-weight: 500; } /* ======= rgba(129, 212, 250, 1) =========*/
.temp-max { color: #ff8a65 !important; font-weight: 500; } /* ======= rgba(255, 138, 101, 1) =========*/
.temp-flex { width: 100%; }
.temp-main { text-align: center; }
.temp-minmax { display: flex; justify-content: center; }
.temp-minmax span + span { margin-left: 12px; }
.temp-image img { width: 70px; }
.degres-jours {
    color: #fff;
    font-size: 14px; /* ta base 18 */
    text-align: center; /* centré sous temp-min/temp-max */
}

hr.border-light { border-top: 2px solid #ccc; }

.form-control, .form-select, .btn { border-radius:6px; font-size:0.95rem; }
.btn { cursor:pointer; }

#yearSelect {
    font-size: 1.8rem;
    background-color: #222;
    color: #fff;
    border: 1px solid #555;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    vertical-align: middle; /* aligne verticalement avec le texte */
}

#yearSelect:focus {
    outline: none;
    border-color: #1e90ff;
    box-shadow: 0 0 5px rgba(30,144,255,0.5);
}

/* ================== Tableau year ===================*/
/* ===== Cellule ===== */

.pluie-cell,
.dj-cell {
    padding-left: 0px !important;
    padding-right: 6px !important;
    position: relative;
    text-align: center;
    background: transparent !important;
    min-width: 50px;
}

/* ===== Conteneur barre ===== */

.pluie-bar-bg,
.dj-bar-bg {
    width: 100%;
    height: 18px;
    background-color: rgba(255,255,255,0.08);
    border-radius: 6px;
    overflow: hidden;
}

/* ===== Remplissage ===== */

.pluie-bar-fill,
.dj-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
}

/* ===== Valeur ===== */

.pluie-value,
.dj-value {
    margin-top: 4px;
    font-size: 1rem;
    font-weight: 500;
    color: #ffffff;
}

.table-dark {
    vertical-align: middle;
}
.table-dark td.pluie-cell,
.table-dark td.dj-cell {
    padding-left: 4px !important;
    padding-right: 4px !important;
}

.table-dark tbody th:nth-child(3), /* Tmin */
.table-dark tbody th:nth-child(4), /* Tmax */
.table-dark tbody td:nth-child(3), /* Tmin */
.table-dark tbody td:nth-child(4) { /* Tmax */
    text-align: center;      /* centre le texte */
    vertical-align: middle;  /* aligne verticalement au milieu */
}

/* ===================== Headmap =====================*/
.heatmap-container {
    max-width: 447px;    /* largeur maximale de la heatmap */
    margin: 0 auto;    /* centrer */
    margin-top: 40px;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12px, 1fr));
    gap: 3px;
}

.heatmap-day {
    aspect-ratio: 1;
    border-radius: 2px;
    width: 100%;         /* prend toute la largeur de sa cellule */
}

.heatmap-legend {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #ccc;
}

/* ==================== Prévisions ==================== */

.forecast-5days {
    gap: 0px;
    max-width:420px;
    margin:auto;
    align-items:center;
}

.forecast-hourly {
    gap: 0px;
    max-width:420px;
    margin:auto;
    align-items:center;
}

/* ligne prévision */
.forecast-row{
    display:grid;

    grid-template-columns: 70px 45px 70px 70px;
    grid-template-rows: auto auto;

    align-items:center;

    column-gap:5px;
    row-gap:0px;

    padding:0 0;
    width:100%;
    
    position: relative; /* nécessaire pour ::after */
}

.forecast-row::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: rgba(255,255,255,0.3); /* ligne discrète */
}

/* enlever la ligne sur la dernière ligne */
.forecast-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* jour */
.day-date{
    grid-column:1;
    grid-row:1;

    font-weight:bold;
    font-size:1rem;
    margin-bottom:2px;
    white-space:nowrap;
}

/* icône météo */
.weather-icon{
    grid-column:2;
    grid-row:1 / 3;

    text-align:center;
    font-size:1.4rem;
    margin:5px 0;
}

/* bloc températures */
.temp{
    grid-column:3;
    grid-row:1 / 3;

    display:flex;
    flex-direction:column;

    font-size:1.2rem;
    font-weight:500;
    line-height:1;
}

.temp-range{
    font-size:.9rem;
}

.temp-max{
    font-weight:600;
    margin-bottom:5px;
}

.temp-min{
    font-size:0.9rem;
    opacity:0.7;
}

/* pluie */
.prec{
    grid-column:4;
    grid-row:1 / 3;

    display:flex;
    flex-direction:column;

    font-size:1rem;
    font-weight:500;
    line-height:1;
}

.precip{
    font-weight:500;
    text-align:right;
    white-space:nowrap;
    margin-bottom:5px;
}

/* probabilité */
.precip_proba{
    font-size:.85rem;
    font-style:italic;

    text-align:right;
    white-space:nowrap;
}

.forecast-toggle {
    position: relative;
    display: inline-flex;
    border: 1px solid #ccc;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
}

.toggle-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    z-index: 2;
    cursor: pointer;
}

.toggle-label-left,
.toggle-label-right {
    padding: 0.25rem 1rem;
    text-align: center;
    flex: 1;
    z-index: 1;
    transition: background 0.2s;
}

/* Couleur du côté actif */
.toggle-input:not(:checked) ~ .toggle-label-left {
    background: #212529;
    color: white;
}

.toggle-input:not(:checked) ~ .toggle-label-right {
    background: transparent;
    color: black;
}

.toggle-input:checked ~ .toggle-label-left {
    background: transparent;
    color: black;
}

.toggle-input:checked ~ .toggle-label-right {
    background: #212529;
    color: white;
}

/* Conteneur limité pour les prévisions */
.forecast-5days, .forecast-hourly {
    max-height: 169px; /* hauteur initiale pour 4 jours / 4 heures */
    overflow: hidden;
    transition: max-height 0.3s ease;
}

/* Quand on déplie */
.forecast-5days.expanded, .forecast-hourly.expanded {
    max-height: 1000px; /* laisse tout visible */
}

/* Bouton d'extension */
.forecast-expand {
    cursor: pointer;
    font-size: 1.2rem;
    color: #fff;
    user-select: none;
}

.expand-btn {
    display: inline-block;
    transition: transform 0.3s;
}

/* rotation si déplié */
.forecast-5days.expanded + .forecast-expand .expand-btn,
.forecast-hourly.expanded + .forecast-expand .expand-btn {
    transform: rotate(180deg);
}

/* ==================== Pression ==================== */
#pressure-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-left: 0;  /* supprime le padding gauche */
  margin-left: 5px; /* espace avec les autres blocs */
}

.graph-container {
    position: relative;
    height: 100px;   /* ← règle ici la hauteur */
    width: 100%;
    max-width: 320px;
}

#currentPressure {
  display: flex;
  margin-left: 15px;
  font-size: 1.5rem;
  font-weight: bold;
}

.trend-block {
  display: flex;
  margin-top: 10px;
  text-align: center;
  width: 100%;
}

#weather-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    margin: 20px 0;
}

.weather-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    margin: 0 10px;
    min-width: 200px;
}

#pressureChart {
    display: flex;
    width: 100%;
    max-width: 280px; /* largeur maximale */
    height: 100px;    /* hauteur fixe */
}

#rainChart {
    width: 100%;
    height: 300px; /* 50% de la hauteur de la fenêtre */
}

/* ==================== Popup ==================== */
#dayPopup {
    position: fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1050;
}

#dayPopup.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#dayPopup .popup-content {
    background-color: #ffffff;
    color: #000000;
    padding: 20px 30px;       /* PC : padding horizontal 30px */
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    min-width: 250px;
    max-width: 90%;
    position: relative;
    text-align: center;
}

#dayPopup .btn-close {
    position: absolute;
    top: 10px; right: 10px;
    cursor: pointer;
}

/* ==================== Flatpickr ==================== */
#calendarInline {
    width: 100%;
    max-width: 350px;
    margin: 15px auto 0 auto;
    box-sizing: border-box;
}

#calendarInline .flatpickr-calendar {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
}

@media (min-width: 992px) {
    #navbarMenu {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
}

 .custom-toggler {
        border: none;
        padding: 6px;
    }
    
    .toggler-icon {
        display: block;
        width: 28px;
        height: 3px;
        background-color: #b6b6b6;
        border-radius: 2px;
        margin: 5px 0;
        transition: transform 0.25s ease, opacity 0.2s ease;
    }
    
    .custom-toggler[aria-expanded="true"] .top-bar {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .custom-toggler[aria-expanded="true"] .middle-bar {
        opacity: 0;
    }
    
    .custom-toggler[aria-expanded="true"] .bottom-bar {
        transform: rotate(-45deg) translate(6px, -6px);
    }

/* ==================== Responsive mobile ==================== */
@media (max-width: 480px) {
    #navbarMenu {
        position: absolute;
        top: 100%;           /* juste sous la navbar */
        left: 0;
        width: 100%;
        background-color: rgba(0,0,0,0.80);
        flex-direction: column;
        padding: 0.5rem 0;   /* petite marge */
        transition: all 0.3s ease-in-out;
    }

    #navbarMenu .nav-link {
        font-size: 1.2rem;   /* moins gros */
        padding: 0.5rem 1rem;
        text-align: right;    /* aligné sous le bouton */
        margin-left: 1rem;   /* légère marge à gauche */
        color: #fff;
    }
    
    /* titre et bouton sur une seule ligne */
    .navbar .container {
        flex-wrap: nowrap;
    }

    .navbar-brand {
        margin-bottom: 0;
    }

    /* bouton hamburger au-dessus du menu */
    .navbar-toggler {
        margin-left: auto;
        z-index: 1100; /* plus grand que le menu */
    }
    
    /* réduire le padding horizontal du popup pour libérer de la place */
    #dayPopup .popup-content {
        padding: 20px 10px; /* top/bottom 20px, gauche/droite 10px */
    }

    /* calendrier inline prend toute la largeur disponible */
    #calendarInline {
        width: 100%;
        margin: 10px 0 0 0;
        box-sizing: border-box;
    }

    #calendarInline .flatpickr-calendar {
        width: 100% !important;
        max-width: 100%;
        box-sizing: border-box;
        margin: 0;
    }

    /* 7 colonnes exactes pour jours et en-têtes */
    #calendarInline .flatpickr-weekdays .flatpickr-weekday,
    #calendarInline .flatpickr-days .flatpickr-day {
        width: calc(100% / 7) !important;
        min-width: 0 !important;
        padding: 2px 0 !important;
        margin: 0 !important;
        box-sizing: border-box;
        text-align: center;
    }

    /* réduire le texte et padding de l’en-tête mois */
    #calendarInline .flatpickr-months {
        font-size: 0.85rem;
        padding: 2px 0;
    }

    /* réduire la taille du texte des jours de la semaine */
    #calendarInline .flatpickr-weekdays {
        padding: 0 0 2px 0;
    }
    
    .pluie-bar-bg,
    .dj-bar-bg {
        width: 40px;   /* plus compact */
        height: 14px;
    }

    .pluie-value,
    .dj-value {
        font-size: 0.85rem;
    }

    .dj-cell,
    .pluie-cell {
        min-width: 40px;
        text-align: center;
    }
    .table th,
    .table td {
        min-width: 20px; /* encore plus petit sur mobile */
        white-space: normal;
        font-size: 0.85rem;
    }
    
    #rainChart {
    width: 100%;
    height: 250px; /* 50% de la hauteur de la fenêtre */
    }
}