/* ==========================================================================
   Gabarit carte Leaflet : style.css
   Structure : [ titlebar ] / [ panel + map ] / [ footer ]
   ========================================================================== */

/* ----- Variables générales ----- */
:root {
  --header-height: 60px;
  --footer-height: 40px;
  --panel-width: 260px;
  --couleur-principale: #1d3557;
  --couleur-texte: #f1faee;
  --couleur-fond: #457b9d;
}

/* ----- Reset minimal ----- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: system-ui, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
}

/* ----- Barre de titre ----- */
#titlebar {
  height: var(--header-height);
  flex-shrink: 0;
  background: var(--couleur-principale);
  color: var(--couleur-texte);
  display: flex;
  flex-direction: row;
  justify-content: left;
  padding: 0 1rem;
}

#titlebar div {
  margin-right: 10%;
  padding : 5px;
}

#titlebar h1 {
  font-size: 1.2rem;
}

#titlebar p {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* ----- Zone principale ----- */
#main {
  flex: 1;
  display: flex;
  min-height: 0; /* important pour que #map prenne tout l'espace disponible */
}

/* ----- Panneau latéral ----- */
#panel {
  width: var(--panel-width);
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--couleur-fond);
  color: var(--couleur-texte);
  padding: 0.75rem;
  z-index: 1000; /* au-dessus de la carte */
}

#panel h2 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ----- Sélecteur de fonds de tuiles + légendes ----- */
#basemap-selector label {
  display: block;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 6px;
  margin-bottom: 0.25rem;
}

#basemap-selector label:hover {
  background: rgb(255 255 255 / 0.15);
}

/* Mise en évidence du fond sélectionné */
#basemap-selector label.active {
  background: rgb(255 255 255 / 0.25);
  outline: 1px solid var(--couleur-texte);
}

/* Légende : image d'aperçu de chaque fond de tuiles */
#basemap-selector img {
  display: block;
  width: 100%;
  /*height: 60px;*/
  object-fit: cover;
  border-radius: 4px;
  margin-top: 0.25rem;
  border: 1px solid rgb(255 255 255 / 0.4);
}

/* Le libellé à côté de la case radio */
#basemap-selector .label-text {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

/* ----- Carte ----- */
#map {
  flex: 1;
  height: 100%; /* indispensable : Leaflet exige une hauteur explicite */
  background: #ddd;
}

/* ----- Pied de page ----- */
#footer {
  height: var(--footer-height);
  flex-shrink: 0;
  background: var(--couleur-principale);
  color: var(--couleur-texte);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  font-size: 0.8rem;
}

#footer a {
  color: inherit;
}

/* ----- Popups Leaflet ----- */
.leaflet-popup-content {
  font-size: 0.85rem;
}

.leaflet-popup-content b {
  color: var(--couleur-principale);
}

/* ----- Comportement mobile : panneau repliable au-dessus de la carte ----- */
@media (max-width: 700px) {
  #main {
    flex-direction: column;
  }
  #panel {
    width: 100%;
    max-height: 35vh;
  }
  #map {
    flex: 1;
  }
}

/* Conteneur de l'icône Leaflet */
.icon-info {
    background: transparent;
    border: none;
}

/* Rond jaune avec i bleu en italique */
.icon-info-rond {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;

    background-color: #f4d84a;
    border: 2px solid #ffffff;
    border-radius: 50%;

    color: var(--couleur-principale);
    font-family: Georgia, serif;
    font-size: 22px;
    font-style: italic;
    font-weight: bold;
    line-height: 1;

    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.55);
    box-sizing: border-box;
}

/* Élément de légende */
.legende-item {
  /*background: rgb(255 255 255 / 0.25);
  outline: 1px solid var(--couleur-texte);
  border-radius: 6px;*/
  padding: 0.35rem;

  margin-bottom: 0.25rem;
    display: flex;
    flex-direction: row;
    align-items: left;
    gap: 10px;
}

/* Figuré de légende */
.legende-item .icon-info-rond {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    width: 30px;
    height: 30px;
}
