/* Reset e Impostazioni Base (come prima) */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%; width: 100%; overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: #f0f0f0; /* Sfondo base leggermente grigio */
    color: #333;
    -webkit-tap-highlight-color: transparent;
    font-size: 16px; line-height: 1.5;
}
/* Contenitore principale dell'app */
#app-container {
    position: relative; /* Necessario per posizionare elementi overlay */
    width: 100%;
    height: 100%;
    overflow: hidden; /* Nasconde lo scroll dell'app container */
}
/* Contenitore Mappa */
#map {
    width: 100%;
    height: 100%; /* La mappa occupa tutto l'app-container */
    background-color: #e0e0e0; /* Colore placeholder mappa */
    z-index: 1; /* Base layer */
}
.leaflet-div-icon {
    background: transparent!important;
    border: none!important;
    color: black;
}
.red {
    color: red!important;
}
.legend { 
    background: white; 
    line-height: 1.5em; 
    padding: 6px 8px; 
    font: 14px/16px Arial, Helvetica, sans-serif; 
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    border: 2px solid #ccc;
    font-family: Arial, sans-serif;
    font-size: 1em;
    line-height: 1.5;
    color: #333;
}
.legend a { text-decoration: none; color: #333; }
.legend a:hover { text-decoration: underline; color: #555; }
/* Stile per le etichette delle città */
 #map .leaflet-tooltip.city-label {
    font-size: 1.2em; 
    font-weight: bold;
    color: rgb(255, 255, 255); 
    background-color: rgb(0, 56, 168); 
    padding: 2px 5px; 
    border-radius: 3px; 
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    margin-left: 10px; /* Sposta l'etichetta a destra del puntatore */
}
/* Stile per le etichette delle città evidenziate */
#map .leaflet-tooltip.highlight-label {
    font-size: 1.4em; 
    font-weight: bold; 
    color: rgb(248, 248, 248); 
    background-color: rgb(0, 122, 51); 
    padding: 2px 5px;
    border-radius: 3px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    margin-left: 10px; /* Sposta l'etichetta a destra del puntatore */
}

/* Puntatore per le etichette delle città normali che puntano a sinistra */
#map .leaflet-tooltip.city-label.leaflet-tooltip-right::before {
    border-color: transparent rgb(0, 56, 168) transparent transparent !important; /* Colore blu per il bordo destro */
}

/* Puntatore per le etichette delle città in evidenza che puntano a sinistra */
#map .leaflet-tooltip.highlight-label.leaflet-tooltip-right::before {
    border-color: transparent rgb(0, 122, 51) transparent transparent !important; /* Colore verde per il bordo destro */
}

/* Stile per il tooltip degli aeroporti */
#map .leaflet-tooltip {
    background-color: Gold;/* Colore di sfondo SkyBlue */
    padding: 5px; /* Aggiungi padding per migliorare la leggibilità */
    border-radius: 3px; /* Angoli arrotondati per un aspetto più gradevole */
    color: black; /* Colore del testo */
    font-weight: bold; /* Testo in grassetto */
}
.rotate-icon {
    font-size: 50px;
    color: white;
}
.legend-content {
    display: block;
    transition: max-height 0.3s ease-out;
    overflow: hidden;
}
.legend-toggle {
    cursor: pointer;
    color: blue;
    text-decoration: underline;
}
@media (max-width: 600px) {
  .legend {
    font-size: 0.8em;
    padding: 5px;
  }
  .logo {
    display: inline !important;
    width: 120px !important;
    height: auto !important;
  }
  .legend-content img {
    width: 120px !important;
    height: auto !important;
  }
  .text-link {
    display: none !important;
  }
  .poi-panel {
    min-width: 180px;
    font-size: 0.95em;
    padding: 12px 8px 8px 8px;
  }
}
.compass-icon {
    width: 30px;
    height: 30px;
    position: relative;
    transform-origin: center center;
    transition: transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.compass-icon svg {
    width: 100%;
    height: 100%;
    transform: rotate(0deg);
}

/* Barra Menu Inferiore */
#bottom-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px; /* Altezza barra menu */
    background-color: #ffffff;
    border-top: 1px solid #cccccc;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-around; /* Spazio tra i pulsanti */
    align-items: center;
    z-index: 1000; /* Sopra la mappa e altri elementi non modali */
    padding: 0 10px; /* Padding laterale */
    padding-bottom: env(safe-area-inset-bottom); /* Supporto per notch/home bar iOS */
}

.menu-btn {
    background: none;
    border: none;
    color: #8e8e93; /* Grigio standard iOS per icone inattive */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem; /* Testo piccolo sotto icona */
    padding: 8px;
    cursor: pointer;
    transition: color 0.2s ease;
    flex-grow: 1; /* Occupa spazio equamente */
    max-width: 100px; /* Limita larghezza pulsanti */
    min-height: 44px; /* Touch target minimo */
    position: relative; /* Per il badge indicatore geolocalizzazione */
}
.menu-btn i { /* Stile Icone FontAwesome */
    font-size: 1.4rem; /* Dimensione icona */
    margin-bottom: 3px;
}
.menu-btn span {
    line-height: 1.2;
}

/* Indicatore geolocalizzazione attiva (pulsante Walk) */
.menu-btn .geo-indicator {
    position: absolute;
    top: 6px;
    right: 18px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981; /* verde */
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: geoPulse 1.6s infinite;
}

@keyframes geoPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Solo-schermo-lettore (accessibilità) */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.menu-btn:hover {
    color: #555;
}
/* Stile pulsante attivo (opzionale) */
.menu-btn.active {
    color: #007AFF; /* Blu Apple per attivo */
}
.leaflet-control-attribution { /* Attribuzione più discreta */
    background-color: rgba(255, 255, 255, 0.7) !important;
    color: #555 !important;
    font-size: 0.7rem !important;
    padding: 2px 5px !important;
    border-radius: 3px;
    margin-right: 5px !important;
    margin-bottom: 70px !important; /* Sopra la barra menu */
}

/* Website Promotion */
.website-promotion {
    position: fixed;
    left: 10px;
    bottom: 75px; /* Position above the bottom menu */
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 30px 8px 12px; /* Added more right padding for close button */
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.5s ease;
    font-size: 12px;
    max-width: 300px;
    backdrop-filter: blur(2px);
    border-left: 3px solid #e74c3c;
}

.website-promotion.visible {
    transform: translateY(0);
    opacity: 1;
}

.website-promotion a {
    color: #0066cc;
    text-decoration: none;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.website-promotion a:hover {
    text-decoration: underline;
}

.website-promotion .close-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.1);
    border: none;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
}

.website-promotion .close-btn:hover {
    background: rgba(0,0,0,0.2);
    color: #333;
}
/* Bottom Sheet base (nuovo stile per pannelli) */
.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.2);
    z-index: 3001;
    width: 100%;
    max-height: 70vh;
    transform: translateY(100%);
    transition: transform 0.25s ease;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 1rem;
    color: #222;
}
.bottom-sheet.open {
    transform: translateY(0);
}
.bottom-sheet label {
    display: block;
    margin-bottom: 12px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
}
.bottom-sheet label:focus-within {
    box-shadow: 0 0 0 2px #0a58ca;
    background: #f6faff;
}
.bottom-sheet label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

/* Backdrop per i bottom sheets */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.sheet-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Header del bottom sheet con maniglia */
.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 0 12px 0;
}
.sheet-handle {
    width: 36px;
    height: 4px;
    background: #ccc;
    border-radius: 2px;
    margin: 0 auto 8px auto;
}
.sheet-close {
    background: transparent;
    border: none;
    font-size: 20px;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    line-height: 1;
    cursor: pointer;
}
.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.header-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
}
.sheet-close:focus-visible,
.menu-btn:focus-visible,
.website-promotion .close-btn:focus-visible {
    outline: 2px solid #0a58ca;
    outline-offset: 2px;
}

/* Action buttons inside sheets */
.sheet-actions {
    display: flex;
    gap: 8px;
    margin: 4px 0 12px 0;
}
.sheet-actions .action-btn {
    border: 1px solid #c7d7f7;
    background: #e9f0fe;
    color: #0a58ca;
    border-radius: 10px;
    padding: 8px 12px;
    min-height: 44px;
    cursor: pointer;
}
.sheet-actions .action-btn:active { transform: translateY(1px); }
.sheet-actions .action-btn:focus-visible { outline: 2px solid #0a58ca; outline-offset: 2px; }

/* Accordion styles (Info bottom sheet) */
.accordion-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f6faff;
    border: 1px solid #c7d7f7;
    border-radius: 10px;
    margin: 6px 0;
    cursor: pointer;
    font-weight: 600;
}
.accordion-header[aria-expanded="true"] {
    background: #e9f0fe;
}
.accordion-content {
    list-style: none;
    margin: 6px 2px 10px 2px;
    padding-left: 8px;
}
.accordion-content li {
    margin: 4px 0;
}
.poi-item {
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
}
.poi-item:hover {
    background: #fafafa;
}
.poi-item:focus-visible {
    outline: 2px solid #0a58ca;
    outline-offset: 2px;
}

.user-location-marker.tracking::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    border: 2px solid rgba(0, 123, 255, 0.45);
    border-radius: 999px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: userRingBlue 2s infinite;
    pointer-events: none;
}

.user-location-marker .heading-wrap {
    position: relative;
    width: 30px;
    height: 30px;
    transform-origin: 50% 50%;
    transition: transform 0.12s linear;
}

.user-location-marker .dash {
    position: absolute;
    width: 2px;
    height: 120px;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    background: repeating-linear-gradient(
      to bottom,
      rgba(0, 123, 255, 0.95) 0px,
      rgba(0, 123, 255, 0.95) 5px,
      transparent 5px,
      transparent 10px
    );
    opacity: 0;
    pointer-events: none;
}

.user-location-marker.tracking .dash {
    opacity: 0.7;
}

@keyframes userRingBlue {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

/* === Search panel readability improvements (v1.8.8) === */
@media (max-width: 768px) {
    #info-panel input[type="search"] {
        font-size: 1.05rem;
        padding: 12px 14px;
    }

    #info-panel .accordion-header {
        font-size: 1.08rem;
        padding: 12px 14px;
        line-height: 1.4;
    }

    #info-panel .accordion-content li {
        margin: 5px 0;
    }

    #info-panel .poi-item {
        font-size: 1rem;
        padding: 11px 12px;
        line-height: 1.4;
    }

    #info-panel #info-help {
        font-size: 0.98rem;
        line-height: 1.45;
    }
}
