*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


body {
  font-family:Arial, Helvetica, sans-serif;
  display: flex;
  gap: 1rem;
  flex-direction: column;
  background-image: url("../images/DESTI_Plagne-Aime2000-vue-vallee_hiver.jpg");
  background-repeat: no-repeat;
  background-position: center -20rem;

  overflow-x: hidden;
}

#main_info {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: auto;
  margin-top: 1rem;
}

#section_current {
  color: white;
  background-color: rgba(81, 81, 81, 0.325);
  backdrop-filter: blur(1.5px);  
  border: 1px solid white;
  border-radius: 1rem;

  display: flex;
  flex-direction: column;

  padding: 1rem;
  gap: 0.5rem;
  width: max-content;
  margin: auto;
  font-size: 1rem;
}

#container_current_city_info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#section_current h3 {
  color: #c3dcf8;
}

#basic_info {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

#current_snow {
    background-color: #118FE4;
    color: white;
    padding: 0.2rem;
    border-radius: 0.5rem;
}

#info_station {
  display: none;
  margin: auto;
  color: white;
  background-color: rgba(81, 81, 81, 0.325);
  backdrop-filter: blur(2px);  
  border: 1px solid white;
  border-radius: 1rem;
  padding: 1rem;
  /* margin-left: 1rem; */
  /* margin-right: 1rem; */

  font-size: 0.9rem;
}

#info_station h3 {
  margin: 0;
}

#info_station_select {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.bulletin-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.95rem;
}

/* Le label à gauche (ex: "Dernière chute") */
.bulletin-label {
    color: #ddd; /* Gris clair pour le texte secondaire */
    font-weight: 500;
}

/* La valeur à droite (ex: "20 cm") */
.bulletin-value {
    font-weight: bold;
    color: white;
}

/* --- BADGES RISQUE AVALANCHE --- */
.risk-badge {
    padding: 4px 10px;
    border-radius: 20px; /* Forme pilule */
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Couleurs dynamiques pour le risque */
.risk-low { 
    background: #27ae60; /* Vert */
}
.risk-med { 
    background: #f39c12; /* Orange/Jaune */
}
.risk-high { 
    background: #c0392b; /* Rouge */
}

/* --- BADGE NEIGE FRAÎCHE (Bleu) --- */
.snow-fresh {
    color: #4fc3f7 !important; /* Bleu cyan lumineux */
    text-shadow: 0 0 5px rgba(79, 195, 247, 0.4);
}

#domaine_height {

  display: flex;       /* Ajouté pour que justify-content fonctionne */
  align-items: center; 
  justify-content: center;

  position: relative;
  min-width: 200px;

  color: white;

}

#height-select {
    /* On enlève le style par défaut moche du navigateur */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    /* Nouveau Style */
    width: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 0.5rem; /* Padding droit large pour la flèche */
    border-radius: 25px; /* Bords bien ronds */
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

#height-select:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: #fff;
}

#height-select:focus {
    box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.5); /* Lueur bleue au clic */
}

/* Les options du menu (Fond noir obligatoire sinon illisible) */
#height-select option {
    background-color: #333;
    color: white;
}

/* La petite flèche personnalisée ▼ */
#domaine_height::after {
    content: '▼';
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none; /* Le clic passe au travers */
}

/* --- LE TEXTE QUALITÉ NEIGE --- */
#infos_neige {
    background: rgba(79, 195, 247, 0.1); /* Fond bleu très léger */
    border-left: 4px solid #4fc3f7; /* Barre bleue à gauche */
    padding: 15px;
    border-radius: 0 8px 8px 0;
    
    font-size: 1rem;
    color: #e0f7fa;
    text-align: left;
    font-weight: 500;
}

/* --- LES 4 CASES DE DONNÉES MÉTÉO --- */
.box-donnee-neige {
    /* Fond NOIR transparent (au lieu de blanc) pour le contraste */
    background-color: rgba(38, 36, 36, 0.5); 
    backdrop-filter: blur(4px); /* Petit flou pour lisser le fond */
    
    /* Bordure et espacement */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    
    /* Texte */
    color: white;
    text-align: center;
    flex: 1 1 auto; /* S'adapte à la largeur */
    min-width: 100px; /* Évite qu'elles soient trop écrasées */
}

/* Le titre dans la case (ex: 1500m) */
.box-donnee-neige .label {
    display: block;
    font-size: 0.75rem;
    color: #ccc; /* Gris clair pour moins d'importance que la valeur */
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* La valeur (ex: 50 cm) */
.box-donnee-neige .valeur {
    font-weight: bold;
}

#infos_neige, #domaine_height, #bulletin_live {
  display: none;
}

#section_prevision {
  display: flex;
  gap: 1rem;
  margin: auto;

  flex-wrap: nowrap;           /* Tout sur une ligne */
  overflow-x: auto;            /* Active le scroll horizontal INTERNE */
  width: 100%;                 /* Prend la largeur disponible */
  max-width: 100vw;            /* 🛑 Ne dépasse JAMAIS la largeur de l'écran */
  box-sizing: border-box;      /* Le padding ne s'ajoute pas à la largeur */
  /* justify-content: flex-start; */

  color: black;
  background-color: rgba(81, 81, 81, 0.325);
  backdrop-filter: blur(2px);  
  border: 1px solid white;
  border-radius: 1rem;
  padding: 1rem;
  /* margin-left: 1rem; */
  /* margin-right: 1rem; */

  font-size: 0.9rem;
}


/* La barre verticale fine */
#section_prevision::-webkit-scrollbar {
    width: 0.1px; 
}

/* Le fond */
#section_prevision::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05); 
}

/* La poignée */
 #section_prevision::-webkit-scrollbar-thumb {
    background: #ccc; 
    border-radius: 10px;
}

#section_prevision::-webkit-scrollbar-thumb:hover {
    background: #bbb; 
} 

.jour-card {
    border: 1px solid #ddd;  
    border-radius: 8px;      
    padding: 1rem;
    background-color: #f9f9f9;

    /* POUR LE SCROLL HORIZONTAL (Rappel) */
    min-width: 280px; 
    flex-shrink: 0;

    /* 👇 LA SOLUTION POUR LA HAUTEUR */
    max-height: 73vh;  /* La carte ne dépassera jamais 60% de la hauteur de l'écran */
    overflow-y: auto;  /* Si ça dépasse, on scroll à l'intérieur de la carte */
    
    /* Optionnel : Pour que le titre reste accroché en haut quand on scroll */
    position: relative;

}

.jour-card h3 {
    margin-top: 0;
    color: #333;
    font-size: 0.8rem;
    text-align: center;
    border-bottom: 2px solid #007bff; 
    margin-bottom: 0.5rem;
}

.heure-row {
    display: grid;
    grid-template-columns: 55px 60px 1fr; 
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dotted #ccc;
    font-size: 0.8rem;
    gap: 5px;
}

.heure-row .heure {
    text-align: left;
}

.heure-row .temp {
    text-align: center; 
}

.heure-row .meteo {
    text-align: right;
    
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 
    
    /* font-size: 0.9em; */
}

.controls-container {
    background-color: rgba(81, 81, 81, 0.325);
    backdrop-filter: blur(2px);
    border: 1px solid white;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    width: max-content;
    color: white;

    min-width: 250px;
    justify-content: center;
}

#model-select, #city-select, #hight-select{
    padding: 0.3rem;
    border-radius: 0.3rem;
    border: 1px solid #ccc;
    background-color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    color: #333;
    font-weight: bold;
}

#city-select {
  padding-right: 1.5rem;
}

/* --- RESPONSIVE (MOBILE & TABLETTE) --- */
@media screen and (max-width: 768px) {

  body {
    background-position: center center; 
    background-size: cover; 
    padding: 10px; 
    /* On laisse le body grandir autant qu'il veut */
    height: auto;
    overflow-y: auto; 
  }

  /* 1. LA GRANDE STRUCTURE : On empile tout verticalement */
  #main_info {
    display: flex;
    flex-direction: column; /* Ville en haut, Météo au milieu, Modèle en bas */
    width: 100%;
    gap: 1rem;
    align-items: center;
  }

  #section_current {
    width: 100%; 
    box-sizing: border-box; 
  }

  #container_current_city_info {
    gap: 1rem;
  }

  /* 2. LES BOITES DE CONTRÔLE (Ville & Modèle) */
  .controls-container {
    width: 100%;
    box-sizing: border-box;
    gap: 0.5rem;
    align-self: auto; /* On enlève le flex-end pour que ça se centre */
    text-align: center;
  }

  /* On applique le style "Gros bouton" aux DEUX sélecteurs */
  #model-select, #city-select {
    width: 100%;
    margin-left: 0;
    padding: 12px;
    font-size: 1rem;
    display: block;
  }

  #info_station {
    width: 100%; /* Prend toute la largeur */
    box-sizing: border-box;
    margin-top: 1rem; /* Espace avec le bloc du dessus */
  }

  #info_station_select {
    flex-direction: column; /* Empile le titre et le sélecteur */
    align-items: flex-start;
    gap: 0.5rem;

  }

  #info_station h3 {
    margin-bottom: 0.5rem;
    text-align: center;
  }

  #domaine_hight {
    width: 100%; /* Le cadre prend toute la largeur */
    box-sizing: border-box;
    padding: 0; /* On enlève le padding pour que le select colle aux bords */
    border: none; /* Optionnel : on peut enlever la bordure du cadre sur mobile */
    background: transparent; /* Fond transparent pour alléger */
  }

  /* Le sélecteur Haut/Bas devient gros comme les autres */
  #height-select {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    display: block;
    /* background-color: rgba(255, 255, 255, 0.9); */
  }

  .box-donnee-neige {
    /* Fond NOIR transparent (au lieu de blanc) pour le contraste */
    background-color: rgba(90, 90, 90, 0.5); 
}

.box-donnee-neige .label {
    color: #e4e4e4; /* Gris clair pour moins d'importance que la valeur */

}

  /* 3. LE CONTENEUR PRÉVISIONS */
  #section_prevision {
    flex-direction: column; 
    width: 100% !important; /* Force la largeur 100% même si le JS dit fit-content */
    box-sizing: border-box;
    gap: 1.5rem; 
    
    /* ON LIBÈRE TOUT */
    overflow: visible; 
    height: auto;      
    flex-wrap: wrap;   
  }

  /* 4. LES CARTES (JOURS) */
  .jour-card {
    width: 100%;
    box-sizing: border-box;
    
    max-height: none;  
    height: auto;      
    overflow: visible; 
  }

  /* 5. L'ALIGNEMENT DES LIGNES (GRID) */
  .heure-row {
    display: grid;
    /* Répartition : 15% Heure | 20% Temp | Reste Texte */
    grid-template-columns: 60px 60px 1fr; 
    align-items: center;
    padding: 10px 0;
  }

  .heure-row .heure {
    width: auto;      
    text-align: left;
    font-size: 0.9rem;
  }

  .heure-row .temp {
    width: auto;
    text-align: center;
    margin: 0 auto; /* Important pour le centrage */
  }

  .heure-row .meteo {
    text-align: right;
    white-space: normal; /* Le texte passera à la ligne si trop long */
    font-size: 0.8rem; 
  }
}

