/* ==========================================================================
   A.R.M.S. MESHTASTIC - MAIN MAP CSS STYLESHEET
   Riorganizzato per efficienza, chiarezza e supporto mobile completo
   ========================================================================== */

/* ==========================================================================
   01. GLOBAL & FULLSCREEN SETUP
   ========================================================================== */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #111111;
    overflow: hidden; /* Prevents global scroll, scroll is managed inside the sidebar */
}

#arms-map-fullscreen-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;       /* Fallback per vecchi browser */
    height: 100dvh;      /* MODIFICA: Altezza dinamica che calcola le barre del browser */
    z-index: 999;
}

#mesh-map-view {
    width: 100% !important;
    height: 100% !important;
    background-color: #111111 !important;
}

/* ==========================================================================
   02. TOP BAR & BANNER (UI)
   ========================================================================== */
#arms-map-banner {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(5px);
    border: 1px solid #333333;
    padding: 8px 16px 8px 10px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
    font-family: 'Urbanist', sans-serif;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Hides floating Top Bar smoothly when sidebar is OPEN */
body.sidebar-open #arms-map-banner {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-10px);
}

.mesh-sidebar-btn {
    background: #252525;
    color: #00e676;
    border: 1px solid #444444;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mesh-sidebar-btn:hover {
    background: #00e676;
    color: #111111;
    border-color: #00e676;
}

.banner-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 18px;
    color: #00e676;
    letter-spacing: 1px;
}

.meshtastic-logo-mask {
    width: 28px;
    height: 28px;
    background-color: #00e676;
    -webkit-mask: url('../media/meshtastic_48.svg') no-repeat center / contain;
    mask: url('../media/meshtastic_48.svg') no-repeat center / contain;
    display: inline-block;
    flex-shrink: 0;
}

.banner-title {
    font-size: 14px;
    color: #ffffff;
    font-weight: 600;
    border-left: 1px solid #444444;
    padding-left: 12px;
    letter-spacing: 0.5px;
    white-space: nowrap; 
}

#node-counter {
    display: inline-block;
    vertical-align: middle;
    font-size: 13px;
    font-weight: 600;
    color: #00e676;
    white-space: nowrap;
}

/* ==========================================================================
   03. SIDEBAR LAYOUT & CONTENT
   ========================================================================== */
.mesh-sidebar {
    position: absolute;
    top: 0;
    left: -320px;
    width: 300px;
    bottom: 0;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(8px);
    z-index: 1001;
    color: #eee;
    font-family: 'Urbanist', sans-serif;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.6);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.mesh-sidebar.active {
    left: 0;
}

.mesh-sidebar-header {
    padding: 15px 20px;
    background: #111111;
    border-bottom: 1px solid #333333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Prevents header from shrinking when content overflows */
}

.mesh-sidebar-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: #00e676;
    letter-spacing: 0.5px;
}

.mesh-sidebar-close-btn {
    background: transparent;
    border: none;
    color: #888888;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.mesh-sidebar-close-btn:hover {
    color: #ffffff;
}

/* FIX: Independent scrolling for sidebar content */
.mesh-sidebar-content {
    padding: 10px 5px 60px 5px; /* MODIFICA: Aggiunti 60px di spazio vuoto in basso */
    overflow-y: auto;
    flex-grow: 1;
    min-height: 0; 
    -webkit-overflow-scrolling: touch; 
}

.mesh-sidebar-top-info {
    background: #181818;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.mesh-info-label {
    color: #aaaaaa;
    font-weight: 600;
}

.mesh-info-val {
    color: #00e676;
    font-weight: 800;
}

.mesh-sidebar-section {
    margin-bottom: 20px;
    border-bottom: 1px solid #333333;
    padding-bottom: 15px;
}

.mesh-sidebar-section:last-child {
    border-bottom: none;
}

.mesh-sidebar-section h4 {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    color: #00e676;
    letter-spacing: 0.8px;
}

.mesh-sidebar-section h4 i.fa-project-diagram { color: #00d2ff; }
.mesh-sidebar-section h4 i.fa-cloud-sun-rain { color: #ffb74d; }

.mesh-sidebar-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mesh-sidebar-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: #cccccc;
    transition: color 0.2s ease;
}

.mesh-sidebar-label:hover {
    color: #ffffff;
}

.mesh-sidebar-label input {
    accent-color: #00e676;
    cursor: pointer;
}

.mesh-sidebar-status {
    background: #111111;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid #222222;
}

.mesh-status-item {
    display: flex;
    justify-content: space-between;
    color: #aaaaaa;
}

.mesh-status-item strong {
    color: #00e676;
    font-weight: 800;
}

/* ==========================================================================
   04. DROPDOWN (SELECT)
   ========================================================================== */
.mesh-sidebar-select {
    width: 100%;
    padding: 10px 14px;
    background-color: #1a1a1a;
    color: #eeeeee;
    border: 1px solid #333333;
    border-radius: 6px;
    font-family: 'Urbanist', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300e676' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
}

.mesh-sidebar-select:hover, 
.mesh-sidebar-select:focus {
    border-color: #00e676;
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.15);
}

.mesh-sidebar-select option {
    background-color: #1a1a1a;
    color: #eeeeee;
    font-family: 'Urbanist', sans-serif;
    padding: 10px;
}

/* ==========================================================================
   05. LEGENDA & COLOR DOTS (SIDEBAR)
   ========================================================================== */
.mesh-legend-item .legend-icon {
    width: 18px;
    text-align: center;
    color: #00e676;
    font-size: 13px;
}

.mesh-menu-color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.mesh-menu-color-dot.sos-italia { background-color: #d32f2f; box-shadow: 0 0 8px rgba(211, 47, 47, 0.7); }
.mesh-menu-color-dot.sos-umbria { background-color: #2e7d32; box-shadow: 0 0 8px rgba(46, 125, 50, 0.7); }
.mesh-menu-color-dot.sos-test { background-color: #fbc02d; box-shadow: 0 0 8px rgba(251, 192, 45, 0.7); }
.mesh-menu-color-dot.lora-italia { background-color: #0288d1; box-shadow: 0 0 8px rgba(2, 136, 209, 0.7); }
.mesh-menu-color-dot.lora-italia { background-color: #38aadd; box-shadow: 0 0 6px #38aadd; } /* Duplicated in source, merged here */
.mesh-menu-color-dot.arms-sec { background-color: #ff6d00; box-shadow: 0 0 8px rgba(255, 109, 0, 0.7); } /* Replaced by below rule later in source, keeping the most specific one */
.mesh-menu-color-dot.arms-sec { background-color: #ff8c00; box-shadow: 0 0 6px #ff8c00; }
.mesh-menu-color-dot.rqh { background-color: #9c27b0; box-shadow: 0 0 8px rgba(156, 39, 176, 0.7); }
.mesh-menu-color-dot.tratte-rf { background-color: #2ecc71; border: 1px solid #ffffff; box-shadow: 0 0 6px rgba(46, 204, 113, 0.6); }
.mesh-menu-color-dot.default, .mesh-menu-color-dot.unknown { background-color: #888888; }

.mesh-channel-count {
    background: #1a1a1a;
    border: 1px solid #333333;
    color: #888888;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: auto;
}

.mesh-sidebar-label:hover .mesh-channel-count {
    border-color: #00e676;
    color: #00e676;
}

/* Accordion Legend */
.mesh-legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.mesh-legend-arrow {
    color: #00e676;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.mesh-legend-content {
    display: none;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #222222;
}

.mesh-legend-box.active .mesh-legend-content { display: flex; }
.mesh-legend-box.active .mesh-legend-arrow { transform: rotate(180deg); }
.mesh-legend-title.legend-subtitle { margin-top: 8px; }

.mesh-legend-box {
    background: #111111;
    border: 1px solid #222222;
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mesh-legend-title {
    font-size: 11px;
    font-weight: 800;
    color: #888888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.mesh-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #cccccc;
    font-weight: 600;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.legend-line {
    width: 20px;
    height: 3px;
    display: inline-block;
}

.legend-line.solid { background: #00d2ff; }
.legend-line.dashed { background: transparent; border-top: 3px dashed #00d2ff; }

/* ==========================================================================
   06. NEIGHBORS (NODI IN ASCOLTO)
   ========================================================================== */
.mesh-neighbors-container {
    background: #111111;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 10px;
}

.mesh-neighbors-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #222222;
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.mesh-neighbors-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 2px;
}

.mesh-neighbors-list::-webkit-scrollbar { width: 4px; }
.mesh-neighbors-list::-webkit-scrollbar-thumb { background: #333333; border-radius: 2px; }

.mesh-neighbor-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a1a1a;
    border: 1px solid #282828;
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mesh-neighbor-item:hover {
    border-color: #00e676;
    background: #222222;
}

.mesh-neighbor-info { display: flex; flex-direction: column; gap: 2px; }
.mesh-neighbor-name { font-size: 15px; font-weight: 700; color: #e0e0e0; display: flex; align-items: center; gap: 6px; }
.mesh-neighbor-meta { font-size: 13px; color: #888888; }
.mesh-neighbor-badges { display: flex; align-items: center; gap: 6px; }
.mesh-snr-badge { font-weight: 700; padding: 1px 6px; border-radius: 4px; color: #000000; }

.mesh-popup-neighbors-toggle {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #444444;
    font-size: 11px;
    color: #00e676;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mesh-popup-neighbors-list {
    margin-top: 6px;
    max-height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mesh-popup-neighbor-row {
    font-size: 12px;
    background: #181818;
    padding: 3px 6px;
    border-radius: 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==========================================================================
   07. LEAFLET OVERRIDES & MAP ELEMENTS
   ========================================================================== */
.leaflet-top { top: 60px !important; }

.map-back-btn {
    position: absolute;
    bottom: 25px;
    left: 20px;
    z-index: 1000;
    background-color: #1a1a1a;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
    border: 1px solid #333333;
    transition: all 0.2s ease-in-out;
}

.map-back-btn:hover {
    background-color: #222222;
    color: #00e676;
    border-color: #00e676;
}

.leaflet-control-layers {
    background: #1a1a1a !important;
    color: #ffffff !important;
    border: 1px solid #333333 !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5) !important;
    border-radius: 6px !important;
    font-family: inherit !important;
    font-size: 12px !important;
}

.leaflet-control-layers-expanded { padding: 10px !important; }

/* ==========================================================================
   08. CUSTOM MARKERS & CHANNELS
   ========================================================================== */
.mesh-custom-marker {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    background: none !important;
    border: none !important;
    transition: transform 0.2s ease-in-out;
}

.mesh-marker-icon-wrapper {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 50% !important;
    background: #2c3e50;
    border: 2px solid #ffffff !important;
    color: #ffffff !important;
    box-shadow: 0 3px 8px rgba(0,0,0,0.5);
    font-size: 14px !important;
    box-sizing: border-box !important;
}

/* Base states */
.mesh-custom-marker.mesh-active .mesh-marker-icon-wrapper { background: #0288d1 !important; border-color: #00e676 !important; color: #ffffff !important; }
.mesh-custom-marker.mesh-inactive .mesh-marker-icon-wrapper { background: #3a3a3a !important; border-color: #757575 !important; color: #b0bec5 !important; opacity: 0.75 !important; }

/* Channel variations */
/* Legacy ARMS */
.mesh-custom-marker.mesh-channel-arms .mesh-marker-icon-wrapper { background-color: #ff6d00 !important; border-color: #00e676 !important; color: #ffffff !important; box-shadow: 0 0 15px rgba(255, 109, 0, 0.75); }
.mesh-custom-marker.mesh-channel-arms:hover .mesh-marker-icon-wrapper { background-color: #ffab40 !important; box-shadow: 0 0 20px rgba(255, 171, 64, 0.9); }
/* SOS-Italia */
.mesh-custom-marker.mesh-channel-sos .mesh-marker-icon-wrapper { background-color: #d32f2f !important; border-color: #ff1744 !important; color: #ffffff !important; box-shadow: 0 0 15px rgba(211, 47, 47, 0.85); }
.mesh-custom-marker.mesh-channel-sos:hover .mesh-marker-icon-wrapper { background-color: #ff1744 !important; box-shadow: 0 0 22px rgba(255, 23, 68, 1); }
/* Ch-Num-0 (SOS-Italia) */
.mesh-custom-marker.mesh-active.mesh-ch-num-0 .mesh-marker-icon-wrapper { background-color: #d32f2f !important; border-color: #ff1744 !important; color: #ffffff !important; box-shadow: 0 0 12px rgba(211, 47, 47, 0.85); }
.mesh-custom-marker.mesh-active.mesh-ch-num-0:hover .mesh-marker-icon-wrapper { background-color: #ff1744 !important; box-shadow: 0 0 18px rgba(255, 23, 68, 1); }
/* Ch-Num-1 (SOS-Umbria) */
.mesh-custom-marker.mesh-active.mesh-ch-num-1 .mesh-marker-icon-wrapper { background-color: #2e7d32 !important; border-color: #00e676 !important; color: #ffffff !important; box-shadow: 0 0 10px rgba(46, 125, 50, 0.8); }
.mesh-custom-marker.mesh-active.mesh-ch-num-1:hover .mesh-marker-icon-wrapper { background-color: #4caf50 !important; box-shadow: 0 0 16px rgba(76, 175, 80, 1); }
/* Ch-Num-2 (SOS-Test) */
.mesh-custom-marker.mesh-active.mesh-ch-num-2 .mesh-marker-icon-wrapper { background-color: #fbc02d !important; border-color: #00e676 !important; color: #111111 !important; box-shadow: 0 0 10px rgba(251, 192, 45, 0.7); }
.mesh-custom-marker.mesh-active.mesh-ch-num-2:hover .mesh-marker-icon-wrapper { background-color: #fdd835 !important; box-shadow: 0 0 16px rgba(253, 216, 53, 0.9); }
/* Ch-Num-3 (LoRa-Italia) */
.mesh-custom-marker.mesh-active.mesh-ch-num-3 .mesh-marker-icon-wrapper { background-color: #0288d1 !important; border-color: #00e676 !important; color: #ffffff !important; box-shadow: 0 0 10px rgba(2, 136, 209, 0.7); }
.mesh-custom-marker.mesh-active.mesh-ch-num-3:hover .mesh-marker-icon-wrapper { background-color: #29b6f6 !important; box-shadow: 0 0 16px rgba(41, 182, 246, 0.9); }
/* Ch-Num-4 (ARMS-SEC) */
.mesh-custom-marker.mesh-active.mesh-ch-num-4 .mesh-marker-icon-wrapper { background-color: #ff6d00 !important; border-color: #00e676 !important; color: #ffffff !important; box-shadow: 0 0 12px rgba(255, 109, 0, 0.75); }
.mesh-custom-marker.mesh-active.mesh-ch-num-4:hover .mesh-marker-icon-wrapper { background-color: #ffab40 !important; box-shadow: 0 0 18px rgba(255, 171, 64, 0.9); }
/* Ch-Num-5 (ALT_5) */
.mesh-custom-marker.mesh-active.mesh-ch-num-5 .mesh-marker-icon-wrapper { background-color: #9c27b0 !important; border-color: #00e676 !important; color: #ffffff !important; box-shadow: 0 0 10px rgba(156, 39, 176, 0.7); }
.mesh-custom-marker.mesh-active.mesh-ch-num-5:hover .mesh-marker-icon-wrapper { background-color: #ba68c8 !important; box-shadow: 0 0 16px rgba(186, 104, 200, 0.9); }
/* Ch-Num-6 (ALT_6) */
.mesh-custom-marker.mesh-active.mesh-ch-num-6 .mesh-marker-icon-wrapper { background-color: #009688 !important; border-color: #00e676 !important; color: #ffffff !important; box-shadow: 0 0 10px rgba(0, 150, 136, 0.7); }
.mesh-custom-marker.mesh-active.mesh-ch-num-6:hover .mesh-marker-icon-wrapper { background-color: #4db6ac !important; box-shadow: 0 0 16px rgba(77, 182, 172, 0.9); }
/* Ch-Num-7 (ALT_7) */
.mesh-custom-marker.mesh-active.mesh-ch-num-7 .mesh-marker-icon-wrapper { background-color: #fbc02d !important; border-color: #00e676 !important; color: #111111 !important; box-shadow: 0 0 10px rgba(251, 192, 45, 0.7); }
.mesh-custom-marker.mesh-active.mesh-ch-num-7:hover .mesh-marker-icon-wrapper { background-color: #fdd835 !important; box-shadow: 0 0 16px rgba(253, 216, 53, 0.9); }

/* Marker Badge */
.mesh-marker-badge {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    background: rgba(26, 26, 26, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid #444444;
    color: #ffffff;
    padding: 3px 10px;
    border-radius: 12px;
    font-family: 'Urbanist', sans-serif;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    transition: all 0.2s ease;
}

.mesh-marker-badge::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px 5px 5px 0;
    border-style: solid;
    border-color: transparent #444444 transparent transparent;
}

.mesh-marker-badge::after {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 4px 4px 4px 0;
    border-style: solid;
    border-color: transparent rgba(26, 26, 26, 0.85) transparent transparent;
}

/* ==========================================================================
   09. ANIMATIONS & ALERTS (SOS, FIRE, GEO, WEATHER)
   ========================================================================== */
@keyframes meshArmsPulseNotification {
    0% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.8); }
    50% { box-shadow: 0 0 0 14px rgba(0, 230, 118, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0); }
}

.mesh-marker-pulse-active .mesh-marker-icon-wrapper {
    animation: meshArmsPulseNotification 2s infinite ease-in-out;
    border-color: #00e676 !important;
    will-change: box-shadow;
}

@keyframes flashUpdate {
    0% { background-color: rgba(46, 204, 113, 0.4); text-shadow: 0 0 8px rgba(46, 204, 113, 0.8); }
    100% { background-color: transparent; text-shadow: none; }
}

.telemetry-flash {
    animation: flashUpdate 1s ease-out;
    border-radius: 3px;
    padding: 0 4px;
    transition: color 0.3s ease;
}

@keyframes meshRadioWaves {
    0% { box-shadow: 0 0 0 0 rgba(255, 23, 68, 0.8), 0 0 0 0 rgba(255, 23, 68, 0.5); }
    100% { box-shadow: 0 0 0 25px rgba(255, 23, 68, 0), 0 0 0 50px rgba(255, 23, 68, 0); }
}

/* Alert States */
.mesh-custom-marker.mesh-alert-active-sos .mesh-marker-icon-wrapper,
.mesh-custom-marker.mesh-active.mesh-alert-active-sos .mesh-marker-icon-wrapper { background-color: #ff1744 !important; border: 2px solid #ffffff !important; color: #ffffff !important; animation: meshRadioWaves 1.8s infinite cubic-bezier(0.25, 0, 0, 1) !important; }
.mesh-custom-marker.mesh-alert-active-sos, .mesh-custom-marker.mesh-active.mesh-alert-active-sos { z-index: 9999 !important; }

.mesh-custom-marker.mesh-alert-active-fire .mesh-marker-icon-wrapper,
.mesh-custom-marker.mesh-active.mesh-alert-active-fire .mesh-marker-icon-wrapper { background-color: #d50000 !important; border: 2px solid #ffea00 !important; color: #ffea00 !important; animation: meshFireBlink 1.8s infinite ease-in-out !important; }
.mesh-custom-marker.mesh-alert-active-fire, .mesh-custom-marker.mesh-active.mesh-alert-active-fire { z-index: 9998 !important; }

.mesh-custom-marker.mesh-alert-active-geo .mesh-marker-icon-wrapper,
.mesh-custom-marker.mesh-active.mesh-alert-active-geo .mesh-marker-icon-wrapper { background-color: #ffea00 !important; border: 2px solid #1a1a1a !important; color: #1a1a1a !important; box-shadow: 0 0 15px rgba(255, 234, 0, 1) !important; }
.mesh-custom-marker.mesh-alert-active-geo, .mesh-custom-marker.mesh-active.mesh-alert-active-geo { z-index: 9997 !important; }

.mesh-custom-marker.mesh-alert-active-work .mesh-marker-icon-wrapper,
.mesh-custom-marker.mesh-active.mesh-alert-active-work .mesh-marker-icon-wrapper { background-color: #7b1fa2 !important; border: 2px solid #ffffff !important; color: #ffffff !important; box-shadow: 0 0 12px rgba(123, 31, 162, 0.8) !important; }
.mesh-custom-marker.mesh-alert-active-work, .mesh-custom-marker.mesh-active.mesh-alert-active-work { z-index: 9996 !important; }

.mesh-custom-marker.mesh-alert-active-weather .mesh-marker-icon-wrapper,
.mesh-custom-marker.mesh-active.mesh-alert-active-weather .mesh-marker-icon-wrapper { background-color: #0d47a1 !important; border: 2px solid #00e676 !important; color: #ffffff !important; box-shadow: 0 0 15px rgba(13, 71, 161, 1) !important; }
.mesh-custom-marker.mesh-alert-active-weather, .mesh-custom-marker.mesh-active.mesh-alert-active-weather { z-index: 9995 !important; }

/* ==========================================================================
   10. POPUPS UNIFICATI & COMPONENTI
   ========================================================================== */
.leaflet-popup-content-wrapper { background: #222222 !important; color: #ffffff !important; border: 1px solid #444444; border-radius: 6px; }
.leaflet-popup-tip { background: #222222 !important; }
.mesh-popup-title { font-size: 14px; font-weight: bold; border-bottom: 1px solid #444444; padding-bottom: 5px; margin-bottom: 8px; color: #00e676; }
.mesh-popup-row { font-size: 12px; margin-bottom: 3px; color: #cccccc; }
.mesh-popup-row strong { color: #aaaaaa; }
.mesh-popup-msg { margin-top: 6px; padding: 4px; background: #111111; border-left: 2px solid #0288d1; font-style: italic; font-size: 11px; color: #e0e0e0; }
.mesh-popup-geo-link { color: #00ff66; text-decoration: none; font-weight: bold; border-bottom: 1px dashed #00ff66; transition: color 0.2s ease; }
.mesh-popup-geo-link:hover { color: #ffffff; border-bottom: 1px solid #ffffff; }

/* ==========================================================================
   11. METEOALARM E SISMICO (GEOJSON)
   ========================================================================== */
.mesh-region-polygon { fill-color: transparent !important; fill-opacity: 0 !important; stroke: #444444 !important; stroke-width: 1.5px !important; stroke-opacity: 0.6 !important; pointer-events: none !important; }

.arms-alert-list { list-style: none !important; padding: 0 !important; margin: 8px 0 0 0 !important; }
.arms-popup-item { margin-bottom: 10px !important; padding-bottom: 8px; border-bottom: 1px solid #333; }
.arms-popup-item:last-child { border-bottom: none !important; margin-bottom: 0 !important; padding-bottom: 0 !important; }
.arms-popup-risk-header { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.arms-popup-icon { font-size: 14px; width: 18px; text-align: center; }
.arms-popup-icon.icon-yellow { color: #f39c12; }
.arms-popup-icon.icon-orange { color: #d35400; }
.arms-popup-icon.icon-red { color: #c0392b; }
.arms-popup-risk-name { font-weight: 600; color: #ffffff; flex-grow: 1; }

.badge-meteo { font-size: 10px !important; text-transform: uppercase; font-weight: 700; padding: 2px 6px !important; border-radius: 4px; letter-spacing: 0.5px; }
.badge-meteo-yellow { background-color: rgba(243, 156, 18, 0.2) !important; color: #f39c12 !important; border: 1px solid #f39c12; }
.badge-meteo-orange { background-color: rgba(211, 84, 0, 0.2) !important; color: #d35400 !important; border: 1px solid #d35400; }
.badge-meteo-red { background-color: rgba(192, 57, 43, 0.2) !important; color: #c0392b !important; border: 1px solid #c0392b; }
.arms-popup-date { display: flex; align-items: center; gap: 6px; font-size: 11px !important; color: #aaaaaa !important; margin-left: 26px; }
.arms-popup-date i { font-size: 10px; color: #666666; }

@keyframes sismicBlink { 0% { stroke-opacity: 0.9; stroke-width: 1px; } 50% { stroke-opacity: 0.4; stroke-width: 5px; } 100% { stroke-opacity: 0.9; stroke-width: 1px; } }
.mesh-sismic-pulsing-marker { animation: sismicBlink 1.8s infinite ease-in-out; }
.mesh-cluster-inner-sismic { width: 30px; height: 30px; line-height: 26px; background: rgba(188, 0, 221, 0.15); border: 2px solid #bc00dd; color: #bc00dd; border-radius: 50%; text-align: center; font-weight: bold; font-size: 11px; box-shadow: 0 0 10px rgba(188, 0, 221, 0.6); }

.arms-map-popup.sismico-popup { padding: 4px; min-width: 240px; }
.arms-map-popup.sismico-popup h3 { margin: 0 0 8px 0; font-size: 13px; color: #ffffff; border-bottom: 1px solid #333; padding-bottom: 4px; font-family: sans-serif; }
.arms-map-popup.sismico-popup .arms-popup-row-data { font-size: 11px; color: #ccc; margin: 4px 0; }
.arms-map-popup.sismico-popup .arms-popup-row-data b { color: #fff; }
.arms-map-popup.sismico-popup .badge-sismico { display: inline-block; padding: 2px 6px; font-size: 9px; font-weight: bold; border-radius: 3px; margin-left: auto; float: right; }
.arms-map-popup.sismico-popup .status-reviewed { background: #27ae60; color: #fff; }
.arms-map-popup.sismico-popup .status-auto { background: #e67e22; color: #fff; }
.arms-map-popup.sismico-popup .arms-popup-date { margin-top: 8px; font-size: 10px; color: #888; border-top: 1px solid #222; padding-top: 4px; }

/* ==========================================================================
   12. TRATTE RF & CLUSTER COMPONENT
   ========================================================================== */
.mesh-tratta-arrow-icon { background: transparent !important; border: none !important; display: flex !important; align-items: center !important; justify-content: center !important; }
.mesh-tratta-arrow-inner { display: inline-block; transform-origin: center center; line-height: 1; }

.mesh-cluster-glow-blue { background: rgba(10, 25, 47, 0.75) !important; border: 2px solid #0288d1 !important; border-radius: 50% !important; box-shadow: 0 0 14px rgba(2, 136, 209, 0.85), inset 0 0 8px rgba(2, 136, 209, 0.5) !important; display: flex !important; align-items: center !important; justify-content: center !important; transition: all 0.2s ease-in-out; }
.mesh-cluster-glow-blue:hover { box-shadow: 0 0 20px rgba(0, 230, 118, 0.9), inset 0 0 10px rgba(0, 230, 118, 0.6) !important; border-color: #00e676 !important; }
.mesh-cluster-inner { width: 100%; height: 100%; display: flex !important; align-items: center !important; justify-content: center !important; color: #ffffff !important; font-weight: 700 !important; font-size: 13px !important; font-family: 'Urbanist', sans-serif !important; letter-spacing: 0.5px; }

/* ==========================================================================
   13. MEDIA QUERIES (MOBILE RESPONSIVE)
   ========================================================================== */
@media (max-width: 768px) {
    #arms-map-banner {
        top: 0; left: 0; right: 0; transform: none; width: 100%; border-radius: 0; border-top: none; border-left: none; border-right: none; border-bottom: 1px solid #333333; padding: 12px 15px; box-sizing: border-box; justify-content: flex-start; background-color: #1a1a1a;
    }
    .banner-logo { font-size: 15px; }
    .meshtastic-logo-mask { width: 18px; height: 18px; }
    .banner-title { font-size: 12px; padding-left: 10px; display: block !important; }
    
    .map-back-btn { bottom: 20px; left: 15px; padding: 14px 18px; font-size: 16px; }
    
    .leaflet-bar a, .leaflet-control-layers-toggle { width: 36px !important; height: 36px !important; line-height: 36px !important; }
}

@media (max-width: 380px) {
    .banner-logo { font-size: 14px; }
    .banner-title { font-size: 10px; padding-left: 8px; }
}