:root {
  --colore-giallo-attivo: #ecf6aa;
  --colore-giallo-non-attivo: #bbc487;
  --colore-layer-informativi: #116865;
  --colore-legenda: #116865;
  --colore-petrolio-non-attivo: #146e6b;
  --colore-petrolio-attivo: #116865;
  --colore-azzurrino: #63b7af;
  --font-family-generale: sans-serif;
  --font-size-legenda: 0.8rem;
  --font-color-legenda: white;
  /* spazio di distacco dal viewport */
  --top: 2.5rem;
  --right: 1rem;
  --left: 1rem;
  --bottom: 2.5rem;
  /* margini */
  --margin-top:0.5rem;
  --margin-bottom:0.5rem;
  --margin-right: 0.5rem;
  /* Bottoni */
  --icon-btn-cicloturismo: 30px;
  --btn-cicloturismo-width: 50px;
}

/* ===========================
   STILE GENERALE 
=========================== */

#map {
  height: 100dvh; /* altezza della mappa. Su mobile l’unità vh classica soffre del “browser chrome” (la barra che entra/esce). Con dvh (dynamic viewport height) la mappa segue correttamente l’altezza visibile. */
  width: 100vw; /* larghezza della mappa */
}

body,
button,
input,
select,
textarea,
.accordion,
.nav-link,
.btn,
.accordion-button,
#legend-button,
#legend-box {
  font-family: var(--font-family-generale) !important;
}

/* ===========================
   BOTTONE "Torna indietro"
=========================== */

#btn-go-back {
  position: fixed;
  top: var(--top);              /* usa le tue variabili già definite */
  left: var(--left);
  width: 50px;
  height: 50px;
  background-color: rgba(17, 104, 101, 0.8); /* petrolio semi trasparente */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: background-color 0.3s ease;
}

#btn-go-back:hover {
  background-color: rgba(17, 104, 101, 1); /* più visibile al hover */
}

#btn-go-back i {
  color: white;
  font-size: 20px;
}


/* ===========================
   NAVBAR
=========================== */

/* Navbar hamburger corretta */
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.7%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-nav .nav-link {
  color: rgb(66, 66, 66);
}

/* ===========================
   CONTENITORE PRINCIPALE
=========================== */

#accordionPercorsiWrapper {
  top: var(--top);
  right: var(--right);
  z-index: 1000;
  width: 300px; /* larghezza fissa */
}

/* Controlli maplibre */

.maplibregl-ctrl {
  position: relative !important;
  top: calc(var(--top) + 70px);
  left: var(--left);
}

/* ===========================
   BOTTONE CIRCOLARE
=========================== */

.btn-percorso-toggle {
  width: 100px;
  height: 100px;
  padding: 0;
  justify-content: center !important;
  border: none;
  margin-left: auto;
  transition: background-color 0.3s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.btn-percorso-toggle::after {
  display: none !important;
}

/* Colori per stato del bottone */
.btn-percorso-toggle.collapsed {
  background-color: var(--colore-giallo-attivo) !important;
  transition: 0.3s ease;
}
.btn-percorso-toggle:not(.collapsed) {
  background-color: var(--colore-giallo-non-attivo) !important;
  width: 60px;
  height: 60px;
  transition: 0.3s ease;
}

/* Dimensione icona quando collapsed */
.btn-percorso-toggle.collapsed img {
  width: 68px;
  height: 68px;
  transition: 0.3s ease;
}

/* Dimensione icona quando NON collapsed */
.btn-percorso-toggle:not(.collapsed) img {
  width: 45px;
  height: 45px;
  transition: 0.3s ease;
}


/* ===========================
   CORPO ITINERARI ESPANDIBILE
=========================== */

.percorsi-body {
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-top: var(--margin-top);
  /* width: 100%; */ /* larghezza responsive */
  width: 300px; /* larghezza fissa */
  background-color: white !important;
}

.accordion-title {
  text-align: center;
  font-weight: 999;
  color: var(--colore-giallo-non-attivo) !important;
  text-shadow: #333;
  font-size: 0.95rem;
  margin-bottom: var(--margin-bottom);
}

/* Questo è il box dei percorsi cicloturistici */
.collegamenti-scrollable {
  max-height: 50vh;                        /* limite massimo pari al 20% dell’altezza visibile dello schermo */
  overflow-y: auto;                        /* attiva lo scroll verticale se serve */
  scrollbar-gutter: stable;                /* evita il salto della scrollbar */
  -webkit-overflow-scrolling: touch;       /* per un migliore scorrimento su dispositivi touch */
}

.icona-narrativa {
  background-color: var(--colore-giallo-non-attivo);
  border-radius: 50%;
  margin-right: var(--margin-right);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem; /* più spazioso */
  flex-shrink: 0;
}

.icona-narrativa img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}



/* ===========================
   SUB ACCORDION TIPOLOGIE
=========================== */

.sub-accordion .accordion-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  background-color: white !important;
  color: black !important;
  /* border: 1px solid #ccc;
  border-radius: 3px; */
}

.sub-accordion .accordion-button:focus {
  box-shadow: none !important;
}

/* .sub-accordion .accordion-button::after {
  filter: brightness(0) invert(1) !important;  rende la freccia bianca 
} */


.sub-accordion .accordion-button .form-check-input {
  margin-right: var(--margin-right); /* spazio tra checkbox e testo */
}

.sub-accordion .accordion-label-text {
  text-align: left;
  flex: 1; /* forza il testo a occupare lo spazio disponibile */
}

.sub-accordion .accordion-body {
  background-color: white !important;
  color: black !important;
  padding: 0.25rem;
}

/* ===========================
   LINK ITINERARI
=========================== */

.sub-accordion ul li a {
  font-size: 0.84rem;
  color: black !important;
  display: block;
  word-wrap: break-word;
  white-space: normal;
  text-decoration: none
}

#toggleContainer {
  bottom: var(--bottom);
  right: var(--right);
  color: black;
  background-color: #e9ecef;
  cursor: pointer;
  z-index: 999;
  position: absolute;
}

/* ======================
  STILE CHECKBOX / TESTO (itinerari e narrative)
  ======================= */

/* Rimuove l'ombra blu (focus ring) attorno ai checkbox */
.form-check-input:focus {
  box-shadow: none;
  outline: none;
}

/* Metto una puntatore anche sul checkbox */
.form-check-input {
  cursor: pointer;
}


/* ============================
   CICLOTURISMO - PULSANTE E MENU
============================ */

/* Wrapper fisso in alto a destra */
#accordionCicloturismoWrapper {
  position: absolute;
  right: 0px; /* sta allineato sulla dx al contenitore, cioè al Bottone dei Pulsanti Paradigma */
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Pulsante circolare */
.btn-cicloturismo-toggle {
  width: var(--btn-cicloturismo-width);
  height: var(--btn-cicloturismo-width);
  padding: 0;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  background-color: white;
  transition: background-color 0.3s ease;
}

.btn-cicloturismo-toggle::after {
  display: none !important;
}

.btn-cicloturismo-toggle.collapsed {
  background-color: var(--colore-petrolio-non-attivo) !important;
}

.btn-cicloturismo-toggle:not(.collapsed) {
  background-color: var(--colore-petrolio-attivo) !important;
}

/* Icona nel bottone cicloturismo */
.btn-cicloturismo-toggle img.img-icon-cicloturismo {
  width: var(--icon-btn-cicloturismo);
  height: var(--icon-btn-cicloturismo);
  filter: brightness(0) invert(1); /* rende l’icona bianca */
}

/* Box contenitore dei percorsi */
#collapseCicloturismo {
  background-color: white;
  border-radius: 0.5rem;
  padding: 0.4rem 0.6rem;
  margin-top: var(--margin-top);
}

/* Titolo "Percorsi Cicloturistici" */
#collapseCicloturismo .accordion-title {
  text-align: center;
  font-weight: 999;
  color: var(--colore-petrolio-non-attivo) !important;
  font-size: 0.9rem;
  margin-bottom: var(--margin-bottom);
  margin-top: var(--margin-top);
  text-transform: uppercase;
}

/* Blocco di ogni percorso cicloturistico */
.percorso-cicloturistico {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.5rem;

  width: 100%; /* Evita comportamenti di overflow o larghezza anomala */
  max-width: 100%;
  box-sizing: border-box;
}

/* Checkbox */
.percorso-cicloturistico input[type="checkbox"] {
  margin-left: 0;
  margin-right: var(--margin-right);
  align-self: center; /* forza allineamento verticale */
  flex-shrink: 0;
  cursor: pointer;
}

/* Icona tonda sfondo azzurrino */
.percorso-cicloturistico .icona-tonda {
  background-color: var(--colore-azzurrino);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: var(--margin-right);
  flex-shrink: 0;
}


/* Immagine interna all'icona */
.percorso-cicloturistico .icona-tonda img {
  width: 30px;
  height: 30px;
}

/* Testo accanto */
.percorso-cicloturistico .testo-percorso {
  font-size: 0.9rem;
  color: black;
  font-weight: bold;
  white-space: nowrap;
  flex-grow: 1;
}

@media (max-width: 600px) {
  #collapseCicloturismo {
    transform: scale(0.85);           /* scala tutto del 85% */
    transform-origin: top right;      /* l’ancoraggio parte dall’angolo in alto a destra */
  }

  /* Opzionale: correggi spazio attorno se serve */
  #accordionCicloturismoWrapper {
    padding-right: 0.5rem;
  }
}

/* ============================
   RESPONSIVE - ITINERARI NARRATIVI
============================ */

@media (max-width: 600px) {
  #collapseMain {
    transform: scale(0.85);          /* scala tutto */
    transform-origin: top right;     /* ancoraggio in alto a destra */
  }

  #collapseMain {
    padding-right: 0.5rem;
  }
}

/* ============================
   RESPONSIVE - POPUP SCALATI
============================ */

@media (max-width: 600px) {
  /* Popup cicloturismo flottante */
  #popup-cicloturismo-floating  {
    transform: translate(-50%, -50%) scale(0.85) !important; /* scala al 85% */
    transform-origin: center center;
  }

  #legend-box,
  #box-layer-informativi {
    transform: scale(0.85) !important; /* scala il box dei layer informativi */
    transform-origin: left bottom;
  }

  /* Popup MapLibre standard e smart */
  .maplibregl-popup-content {
    transform: scale(0.85);
    transform-origin: center center;
  }
}

/* 🔥 RIMUOVE OGNI BORDO DAGLI ACCORDION DI BOOTSTRAP */
.accordion-item {
  border: none !important;
  box-shadow: none !important;
}

.accordion-button {
  border: none !important;
  box-shadow: none !important;
  background-color: transparent !important;
}

/* 🔥 TOGLIE IL BORDO SOLO QUANDO È APERTO */
.accordion-button:not(.collapsed) {
  border-bottom: none !important;
  box-shadow: none !important;
}

/* 🧽 Se vuoi anche togliere il focus ring blu fastidioso */
.accordion-button:focus {
  box-shadow: none !important;
  outline: none !important;
}



/* ============================================
  Bottone leggenda in basso a sinistra 
============================================*/

#legend-box h4,
#legend-box .legend-item span,
#box-layer-informativi h5,
#box-layer-informativi li span {
  font-size: var(--font-size-legenda);
  color: var(--font-color-legenda);
}


#legend-button {
  position: fixed;   /* FISSO */
  bottom: var(--bottom);      /* 20px dal fondo */
  left: var(--left);        /* 20px da sinistra */
  background: var(--colore-legenda);
  color: var(--font-color-legenda);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  z-index: 999;      /* sopra la mappa! */
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}


/* Box leggenda */
#legend-box {
  position: fixed;
  bottom: calc(var(--bottom) + 50px); /* 50px sopra il bottone */
  left: var(--left);
  background: var(--colore-legenda);
  padding: 20px;
  border-radius: 4px;
  display: none; /* nascosto di default */
  max-width: 250px;
  z-index: 999;  /*  sopra la mappa! */
  font-size: var(--font-size-legenda);
  color: var(--font-color-legenda);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

#legend-box h4 {
  margin: 10px 0 5px;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: var(--margin-bottom);
}

.legend-item .line {
  display: inline-block;
  width: 30px;
  height: 2px;
  margin-right: var(--margin-right);
}

.legend-item .fill {
  height: 12px;
  width: 30px;
}

/* ============================================
  Bottone "Legenda servizi"
 ============================================*/
/* PULSANTE giallo semi trasparente */
.btn-layer-informativi {
  position: fixed; /* ancorato al viewport e non dipende più dal flusso/altezza del contenitore. */
  bottom: var(--bottom);
  left: 12rem; /* uguale allo spazio che ha il bottone "Legenda Territorio da sinistra */
  background: var(--colore-layer-informativi); /* giallo semi trasparente */
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  z-index: 1000;
  font-size: var(--font-size-legenda);
  color: var(--font-color-legenda);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* BOX leggenda informativi */
#box-layer-informativi {
  display: none; /* nascosto di default */
  position: fixed; /* ancorato al viewport e non dipende più dal flusso/altezza del contenitore. */
  bottom: calc(var(--bottom) + 50px); /* 50px sopra il bottone */
  left: 12rem; /* uguale allo spazio che ha il bottone "Legenda Territorio da sinistra */
  background: var(--colore-layer-informativi); /* verde leggenda */
  padding: 1rem;
  border-radius: 4px;
  color: #fff;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* Titolo dei layer informativi che è stato nascosto */
/* #box-layer-informativi h5 {
  margin-top: var(--margin-top);
  margin-bottom: var(--margin-bottom);
  font-size: 1rem;
  text-align: center;
  color: rgb(168, 0, 0) !important;
  font-weight: bold !important;
} */

#box-layer-informativi ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

#box-layer-informativi li {
  display: flex;
  align-items: center;
  margin-bottom: var(--margin-bottom);
}

#box-layer-informativi li img {
  width: 30px;
  height: 30px;
  margin-right: var(--margin-right);
}

#box-layer-informativi li span {
  font-size: 14px;
}

.lineetta {
  display: inline-block;
  width: 30px;
  height: 2px; /* default spessore se serve */
  margin-right: var(--margin-right);
}

/* Popup cicloturismo centrato al centro della viewport */
.maplibregl-popup.popup-cicloturismo {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 1001;
  pointer-events: none; /* evita di bloccare tocchi dietro */
}

/* Rimuove freccia */
.maplibregl-popup.popup-cicloturismo .maplibregl-popup-tip {
  display: none !important;
}

/* Rimuove bordi bianchi e padding interni */
.maplibregl-popup.popup-cicloturismo .maplibregl-popup-content {
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
  max-width: unset !important;
}

#popup-cicloturismo-floating {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  pointer-events: none; /* per evitare blocchi mappa */
}

.popup-cicloturismo-contenuto {
  background-color: #333;
  border-radius: 8px;
  color: white;
  padding: 14px 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 600px;
  max-width: 120vw;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Bottone di chiusura per popup cicloturismo */
.popup-cicloturismo-close {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 12px;
  color: white;
  cursor: pointer;
  z-index: 2100;
  font-weight: bold;
  background: transparent;
  border: none;
  pointer-events: auto;
}


/* tolgo bordo bianco anche da openSmartPopup */

.maplibregl-popup.popup-smart .maplibregl-popup-tip {
  display: none !important;
}

.maplibregl-popup.popup-smart .maplibregl-popup-content {
  background: var(--colore-giallo-attivo) !important;
  color: #333 !important;
  border-radius: 6px;
  padding: 1.5rem 1rem 1rem 1rem !important;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
  position: relative;
  max-width: 300px;
}

.popup-smart .popup-close-btn {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  color: black;
  background: transparent;
  border: none;
}

/* Popup percorsi paradigma */

/* Impostazione di base valida per tutti */
.maplibregl-popup-content {
  width: 70vw !important;     /* default per piccoli schermi */
  max-width: 70vw !important; /* rimuove il limite di 240px di MapLibre */
  box-sizing: border-box;     /* importante per evitare overflow */
  padding: 1rem !important; /* padding interno */
}

/* Per schermi più larghi (>768px) imposta larghezza a 20vw */
@media (min-width: 768px) {
  .maplibregl-popup-content {
    width: 20vw !important;
  }
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
  filter: invert(1);
}

/* Lista di collegamenti dei popup dei percorsi paradigma */
.percorsiParadigmaPopup ul li a {
  color: #007bff;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
}
