/* =========================================================================
   IW0RQH - CSS LOCALE SPECIFICO PER SOTTODOMINIO MESHTASTIC
   Tutti i selettori sono incapsulati per prevenire conflitti globali
   ========================================================================= */

#mesh-container #mesh-map-card {
    padding: 0; /* Azzeriamo il padding interno per far toccare la mappa ai bordi */
    background: #1a1a1a;
    border-radius: 8px;
    border: 1px solid #333;
    overflow: hidden;
}

#mesh-container #mesh-map-view {
    width: 100%;
    height: 720px; /* Guadagniamo ulteriore spazio verticale */
    background-color: #242424;
}

.mesh-custom-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box !important;
}

.mesh-marker-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;  /* Forza il fit perfetto nei 36px di Leaflet */
    height: 100%; /* Forza il fit perfetto nei 36px di Leaflet */
    border-radius: 50%;
    box-sizing: border-box; /* Include i 2px di bordo nel calcolo del diametro */
    background: #2c3e50;
    border: 2px solid #ffffff;
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.5);
    font-size: 14px;
}

/* Colore differenziato: Nodi Attivi (visti nelle ultime 2 ore) */
.mesh-custom-marker.mesh-active .mesh-marker-icon-wrapper {
    background: #0288d1; /* Azzurro radio vivo */
    border-color: #00e676; /* Cerchio esterno verde brillante */
    color: #ffffff;
}

/* Colore differenziato: Nodi Inattivi/Storici */
.mesh-custom-marker.mesh-inactive .mesh-marker-icon-wrapper {
    background: #3a3a3a;
    border-color: #757575;
    color: #b0bec5;
    opacity: 0.75;
}

/* Popup di Leaflet adattato allo stile dark della dashboard */
.leaflet-popup-content-wrapper {
    background: #222222 !important;
    color: #ffffff !important;
    border: 1px solid #444;
    font-family: inherit;
    border-radius: 6px;
}

.leaflet-popup-tip {
    background: #222222 !important;
}

/* Adattamento del Controllo Layer al tema scuro */
#mesh-container .leaflet-control-layers {
    background: #222222 !important;
    color: #ffffff !important;
    border: 1px solid #444 !important;
    border-radius: 6px;
    font-family: inherit;
    box-shadow: 0 3px 8px rgba(0,0,0,0.5);
    padding: 10px;
}

#mesh-container .leaflet-control-layers-base label,
#mesh-container .leaflet-control-layers-overlays label {
    margin-bottom: 5px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#mesh-container .leaflet-control-layers-separator {
    border-top: 1px solid #444;
    margin: 8px 0;
}

/* Elementi interni al Popup */
.mesh-popup-title {
    font-size: 14px;
    font-weight: bold;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
    margin-bottom: 8px;
    color: #00e676;
}

.mesh-popup-row {
    font-size: 11px;
    margin-bottom: 4px;
    color: #ccc;
}

.mesh-popup-row strong {
    color: #aaa;
}

.mesh-popup-msg {
    margin-top: 6px;
    padding: 4px;
    background: #111;
    border-left: 2px solid #0288d1;
    font-style: italic;
    font-size: 11px;
    color: #e0e0e0;
}

/* =========================================================================
   COLORAZIONE DINAMICA IN BASE AL CANALE (SOLO PER NODI ATTIVI)
   ========================================================================= */

/* Regole comuni per tutti i nodi attivi (manteniamo il cerchio esterno verde) */
.mesh-custom-marker.mesh-active .mesh-marker-icon-wrapper {
    border-color: #00e676; 
    color: #ffffff;
}

/* Canale 0 - PRIMARY (Azzurro Radio originale) */
.mesh-custom-marker.mesh-active.mesh-ch-0 .mesh-marker-icon-wrapper {
    background: #0288d1;
}

/* Canale 1 - A.R.M.S. (Arancione di sicurezza / Emergenza) */
.mesh-custom-marker.mesh-active.mesh-ch-1 .mesh-marker-icon-wrapper {
    background: #ff6d00; /* Molto visibile e stacca dal rosso del Ch 1 */
}

/* Canale 2 - ALT_2 (Rosso come richiesto) */
.mesh-custom-marker.mesh-active.mesh-ch-2 .mesh-marker-icon-wrapper {
    background: #d32f2f;
}

/* Canale 3 - ALT_3 (Verde Smeraldo) */
.mesh-custom-marker.mesh-active.mesh-ch-3 .mesh-marker-icon-wrapper {
    background: #388e3c;
}

/* Canale 4 - A.R.M.S. (Arancione di sicurezza / Emergenza) */
.mesh-custom-marker.mesh-active.mesh-ch-4 .mesh-marker-icon-wrapper {
    background: #ff6d00; /* Molto visibile e stacca dal rosso del Ch 1 */
}

/* Canale 5 - ALT_5 (Viola) */
.mesh-custom-marker.mesh-active.mesh-ch-5 .mesh-marker-icon-wrapper {
    background: #7b1fa2;
}

/* Canale 6 - ALT_6 (Turchese) */
.mesh-custom-marker.mesh-active.mesh-ch-6 .mesh-marker-icon-wrapper {
    background: #00796b;
}

/* Canale 7 - ALT_7 (Giallo scuro/Ambra) */
.mesh-custom-marker.mesh-active.mesh-ch-7 .mesh-marker-icon-wrapper {
    background: #f5b041;
}

/* Canale 7 - ALT_7 (Marrone / Grigio fumo) */
.mesh-custom-marker.mesh-active.mesh-ch-7 .mesh-marker-icon-wrapper {
    background: #5d4037;
}

