:root {
 --bg-primary: #0a1628;
 --bg-panel: #1e293b;
 --bg-secondary: #0f172a;
 --border-subtle: #334155;
 --text-primary: #e2e8f0;
 --text-secondary: #94a3b8;
 --text-muted: #94a3b8;
 --accent-blue: #3b82f6;
 --accent-amber: #f1c40f;
 --accent-green: #3ab676;
 --font-main: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
 --radius-sm: 6px;
 --radius-md: 10px;
 --sidebar-width: 320px;
 --header-height: 56px;
}

*, *::before, *::after {
 box-sizing: border-box;
 margin: 0;
 padding: 0;
}

html, body {
 height: 100vh;
 width: 100vw;
 overflow: hidden;
 font-family: var(--font-main);
 background: var(--bg-primary);
 color: var(--text-primary);
 line-height: 1.5;
}

#app-header {
 height: var(--header-height);
 background: var(--bg-panel);
 border-bottom: 1px solid var(--border-subtle);
 display: flex;
 align-items: center;
 justify-content: space-between;
 padding: 0 1.25rem;
 flex-shrink: 0;
}

.header-brand {
 display: flex;
 align-items: baseline;
 gap: 0.625rem;
}

.logo-mark {
 font-size: 1.4rem;
 line-height: 1;
}

.header-brand h1 {
 font-size: 1.25rem;
 font-weight: 700;
 letter-spacing: 0.05em;
 text-transform: uppercase;
 margin: 0;
}

.header-subtitle {
 font-size: 0.8rem;
 font-weight: 500;
 color: var(--text-muted);
 border-left: 1px solid var(--border-subtle);
 padding-left: 0.625rem;
 white-space: nowrap;
}

.version {
 color: var(--text-muted);
 font-size: 0.7rem;
 background: var(--bg-secondary);
 padding: 2px 6px;
 border-radius: 4px;
 font-weight: 600;
}

/* === Annotazioni === */
.annot-btn {
    padding: 8px 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    font-family: var(--font-main);
    text-transform: uppercase;
    transition: all 0.2s;
    text-align: center;
}

.annot-btn:hover {
    border-color: #b08968;
    color: #b08968;
}

.annot-btn.annot-active {
    background: #b08968;
    color: #fff;
    border-color: #b08968;
    box-shadow: 0 0 8px rgba(176, 137, 104, 0.4);
}

.header-controls {
 display: flex;
 gap: 0.5rem;
}

.btn {
 display: inline-flex;
 align-items: center;
 gap: 0.5rem;
 padding: 0.5rem 1rem;
 border-radius: var(--radius-sm);
 border: 1px solid var(--border-subtle);
 font-family: var(--font-main);
 font-size: 0.875rem;
 font-weight: 500;
 cursor: pointer;
 background: transparent;
 color: var(--text-secondary);
 min-height: 36px;
}

.btn:hover {
 background: rgba(74, 144, 217, 0.1);
 color: var(--text-primary);
}

.btn.active {
 background: var(--accent-amber);
 color: #1a1a2e;
 border-color: var(--accent-amber);
 font-weight: 600;
}

#app-main {
 display: flex;
 flex: 1;
 overflow: hidden;
 height: calc(100vh - var(--header-height));
}

.sidebar {
 width: var(--sidebar-width);
 background: var(--bg-panel);
 border-right: 1px solid var(--border-subtle);
 display: flex;
 flex-direction: column;
 overflow-y: auto;
 flex-shrink: 0;
}

#sidebar-right {
 border-right: none;
 border-left: 1px solid var(--border-subtle);
}

.panel-section {
 padding: 1.25rem;
 border-bottom: 1px solid var(--border-subtle);
}

.panel-section h2 {
 font-size: 1rem;
 font-weight: 700;
 text-transform: uppercase;
 letter-spacing: 0.05em;
 color: var(--text-secondary);
 margin-bottom: 0.875rem;
}

.layer-toggles {
 display: flex;
 flex-direction: column;
 gap: 0.5rem;
}

.toggle-row {
 display: flex;
 align-items: center;
 gap: 0.625rem;
 cursor: pointer;
 padding: 0.375rem 0;
 color: var(--text-secondary);
 font-size: 0.9375rem;
}

.toggle-row:hover {
 color: var(--text-primary);
}

.toggle-row input[type="checkbox"] {
 width: 1.125rem;
 height: 1.125rem;
 accent-color: var(--accent-blue);
 cursor: pointer;
}

.scenario-select {
 width: 100%;
 padding: 0.625rem 0.875rem;
 background: #0d1724;
 border: 1px solid var(--border-subtle);
 border-radius: var(--radius-sm);
 color: var(--text-primary);
 font-family: var(--font-main);
 font-size: 0.9375rem;
 margin-top: 0.5rem;
 cursor: pointer;
}

#map-wrapper {
 flex: 1;
 position: relative;
 overflow: hidden;
 min-height: 0;
}

#map {
 width: 100%;
 height: 100%;
 background: #0a1628;
 position: absolute;
 top: 0;
 left: 0;
}

.zoom-controls {
 position: absolute;
 top: 12px;
 left: 12px;
 z-index: 500;
 display: flex;
 flex-direction: column;
 gap: 4px;
 background: #1e293b;
 border: 2px solid var(--accent-blue);
 border-radius: 20px;
 padding: 4px;
 backdrop-filter: blur(8px);
 font-family: var(--font-main);
}

.zoom-btn {
 width: 36px;
 height: 36px;
 background: transparent;
 color: var(--text-primary);
 border: none;
 border-radius: 16px;
 font-size: 1.5rem;
 font-weight: 600;
 cursor: pointer;
 display: flex;
 align-items: center;
 justify-content: center;
 transition: all 0.2s ease;
}

.zoom-btn:hover {
 color: #fff;
 background: rgba(59, 130, 246, 0.2);
}

.zoom-btn:active {
 background: var(--accent-blue);
 color: #fff;
 box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.map-overlay {
 position: absolute;
 z-index: 500;
 pointer-events: auto;
}

.timeline {
 bottom: 20px;
 left: 50%;
 transform: translateX(-50%);
 background: rgba(17, 29, 46, 0.95);
 border: 1px solid var(--border-subtle);
 border-radius: var(--radius-md);
 padding: 12px 24px;
 display: flex;
 gap: 16px;
 align-items: center;
 backdrop-filter: blur(8px);
}

.timeline input[type=range] {
 width: 280px;
 accent-color: var(--accent-blue);
}

.timeline span {
 color: var(--text-secondary);
 font-size: 0.875rem;
}

.timeline strong {
 color: var(--accent-blue);
 font-size: 0.9375rem;
}

.basemap-toggle {
 top: 12px;
 right: 12px;
 background: #1e293b;
 border: 2px solid var(--accent-blue);
 border-radius: 20px;
 padding: 4px;
 display: flex;
 gap: 4px;
 backdrop-filter: blur(8px);
 font-family: var(--font-main);
}

.basemap-toggle button {
 padding: 6px 12px;
 background: transparent;
 color: var(--text-primary);
 border: none;
 border-radius: 18px;
 cursor: pointer;
 font-size: 0.78rem;
 font-weight: 650;
 transition: all 0.2s ease;
}

.basemap-toggle button:hover {
 color: #fff;
 background: rgba(59, 130, 246, 0.2);
}

.basemap-toggle button.active {
 background: var(--accent-blue);
 color: #fff;
 font-weight: 700;
 box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

body.lim-mode {
 font-size: 22px;
}

body.lim-mode #app-header {
 height: 90px;
}

body.lim-mode.sidebar {
 width: 16.5rem!important;
 min-width: 280px!important;
 max-width: 400px!important;
}

body.lim-mode.btn {
 font-size: 1.125rem;
 padding: 0.75rem 1.25rem;
}

body.lim-mode.timeline input[type=range] {
 width: 400px;
}

@media (max-width: 900px) {
 #app-main {
 flex-direction: column;
 }
.sidebar {
 width: 100%;
 max-height: 30vh;
 }
}

/* ===== LEAFLET: INTERATTIVITÀ CORRETTA ===== */
/* I marker devono ricevere il click */
.leaflet-marker-icon,
.leaflet-marker-shadow {
 pointer-events: auto;
}

/* I popup devono essere cliccabili (link, bottoni) */
.leaflet-popup-pane {
 pointer-events: auto;
}

/* Le geometrie vettoriali interattive (faglie, poligoni, etc.) */
.leaflet-interactive {
 pointer-events: auto;
 cursor: pointer;
}

/* Classe custom per le faglie */
.fault-line {
 cursor: pointer;
}

/* ===== LEGENDA UNIFICATA ===== */
#map-legend {
    position: absolute !important;
    bottom: 30px !important;
    right: 10px !important;
    z-index: 9999 !important;
    background-color: #0f172a !important;
    padding: 12px 16px !important;
    border-radius: 8px !important;
    color: #ffffff !important;
    font-size: 13px !important;
    font-family: sans-serif !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important;
    display: none; /* Di default nascosta, la mostri il JS quando serve */
}

.legend-title {
 font-weight: bold;
 margin-bottom: 8px;
 color: var(--accent-amber);
 font-size: 14px;
}

.legend-section {
 margin-bottom: 10px;
}

.legend-section strong {
 display: block;
 color: #ffffff;
 margin-bottom: 4px;
 font-size: 12px;
}

.legend-item {
 display: flex;
 align-items: center;
 gap: 8px;
 margin-bottom: 4px;
 font-size: 0.85rem;
 color: var(--text-primary);
}

.legend-item:last-child {
 margin-bottom: 0;
}

.legend-icon {
 display: inline-block;
 width: 18px;
 height: 4px;
 border-radius: 2px;
 flex-shrink: 0;
}

.legend-icon.dot,
.legend-dot {
 width: 12px;
 height: 12px;
 border-radius: 50%;
 border: 1px solid #0a1628;
}

/* ===== OCEANI E MARI ===== */
.ocean-label {
 background: transparent;
 border: none;
 box-shadow: none;
 pointer-events: auto;
 cursor: pointer;
 text-align: center;
}

.ocean-label span {
 display: inline-block;
 color: #8eb4da;
 font-weight: 700;
 font-size: 11px;
 text-transform: uppercase;
 letter-spacing: 0.4px;
 text-shadow:
 0 1px 0 rgba(0, 0, 0, 0.8),
 0 2px 4px rgba(0, 0, 0, 0.6),
 0 0 3px rgba(0, 0, 0, 0.4);
 padding: 1px 4px;
 border-radius: 3px;
 transition: color 0.15s ease, text-shadow 0.15s ease;
 white-space: nowrap;
}

.ocean-label span:hover {
 color: #65aecf;
 text-shadow:
 0 0 6px rgba(176, 226, 255, 0.603),
 0 1px 0 rgba(0, 0, 0, 0.8),
 0 2px 4px rgba(0, 0, 0, 0.6);
}

.ocean-buoy {
 background: transparent!important;
 border: none!important;
}

.ocean-buoy svg {
 width: 16px;
 height: 20px;
 display: block;
 filter: drop-shadow(0px 1px 1px rgba(0,0,0,0.8));
 transition: filter 0.2s ease;
}

.ocean-buoy:hover {
 cursor: pointer;
}

.ocean-buoy:hover svg {
 filter: drop-shadow(0px 0px 4px rgba(255, 255, 255, 0.9));
}

/* ===== CREDITS ===== */
#credits-bar {
 position: absolute;
 bottom: 0;
 left: 50%;
 transform: translateX(-50%);
 background: rgba(255,255,255,0.92);
 color: #1e2229;
 padding: 6px 14px;
 font-size: 11px;
 border-radius: 6px 6px 0 0;
 z-index: 500;
 text-align: center;
 max-width: 95%;
 box-shadow: 0 -2px 6px rgba(0,0,0,0.15);
}

#credits-bar a {
 color: #2a7ae2;
 text-decoration: none;
}

#credits-bar a:hover {
 text-decoration: underline;
}
/* Stile bottoni footer legali */
.legal-footer-btn {
    margin: 0 10px;
    padding: 8px 18px;
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #475569;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}
.legal-footer-btn:hover {
    background: #475569;
    transform: translateY(-2px);
}

/* Stile Modale Legale */
#simmeriaLegalModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 22, 40, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    font-family: var(--font-main);
}
#simmeriaLegalModal .legal-modal-content {
    background: #1e293b;
    padding: 40px;
    border-radius: 16px;
    width: 80%;
    max-width: 800px; /* Finestra molto più larga */
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    color: #e2e8f0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid #475569;
}
#simmeriaLegalModal .legal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    background: #334155;
    color: #e2e8f0;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
#simmeriaLegalModal .legal-close-btn:hover {
    background: #ef4444;
}
#simmeriaLegalModal h2 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 15px;
    font-size: 1.5rem;
    border-bottom: 2px solid #475569;
    padding-right: 40px;
}
#simmeriaLegalModal .legal-text-container {
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.8; /* Interlinea ampia per leggere bene */
    color: #cbd5e1;
}
#simmeriaLegalModal .legal-text-container h3 {
    color: #f8fafc;
    font-size: 1.1rem;
    margin-top: 25px;
    margin-bottom: 10px;
}
#simmeriaLegalModal .legal-text-container p {
    margin-bottom: 15px;
}
#simmeriaLegalModal .legal-text-container ul {
    margin-bottom: 15px;
    padding-left: 20px;
}
#simmeriaLegalModal .legal-text-container li {
    margin-bottom: 8px;
}


/* Effetto hover per i marker dei sismi sovrapposti */
.sismo-marker:hover div {
    transform: scale(1.6);
    z-index: 1000;
}
/* Ingrandisce il quadratino della checkbox SOLO sulla sinistra */
#sidebar-left input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-right: 10px;
    vertical-align: middle;
}

/* Ingrandisce la scritta SOLO sulla sinistra */
#sidebar-left label {
 font-size: 1rem;
 font-weight: bold;
 font-family: var(--font-main);
 cursor: pointer;
 vertical-align: middle;
}

.simmeria-linee-control {
 background: #1e293b;
 border: 1px solid #334155;
 border-radius: 5px;
 box-shadow: 0 1px 7px rgba(0,0,0,0.4);
 padding: 4px; /* Spazio tra il bordo scuro e il bottone azzurro */
}
.simmeria-btn {
 background: #3b82f6;
 color: #ffffff;
 border: none;
 padding: 6px 10px; /* Rimpicciolito */
 border-radius: 3px; /* Angoli arrotondati per l'effetto pillola interno */
 font-size: 12px; /* Testo più piccolo */
 font-family: var(--font-main); /* Eredita il font standard di Leaflet */
 cursor: pointer;
}
.simmeria-btn:hover { background: #3b82f6; }

.sim-gn-citta-tooltip {
 background: #0f172a!important;
 color: #e2e8f0!important;
 border: 1px solid #3b82f6!important;
 opacity: 1!important;
 box-shadow: 0 2px 8px rgba(0,0,0,0.4)!important;
}
/* ============ SIMMERIA RESPONSIVE (CORRETTO — selettori con spazio) ============ */

/* Font-size base per fascia */
@media (min-width: 2560px) { body.lim-mode { font-size: 28px!important; } }
@media (min-width: 1367px) and (max-width: 2559px) { body.lim-mode { font-size: 22px!important; } }
@media (min-width: 1025px) and (max-width: 1366px) { body.lim-mode { font-size: 18px!important; } }
@media (max-width: 1024px) { body.lim-mode { font-size: 16px!important; } }

/* Sidebar — larghezza in modalità LIM (classe aggiunta da toggleLim) */
.sidebar.lim-active {
 width: 360px!important;
 min-width: 280px!important;
 max-width: 400px!important;
}

/* Header */
body.lim-mode #app-header {
 height: 4.3rem!important;
}

/* Pulsanti */
body.lim-mode.btn { /* ← spazio qui */
 font-size: 1.125rem!important;
 padding: 0.85rem 1.35rem!important;
}

/* Slider timeline */
body.lim-mode.timeline input[type=range] { /* ← spazio qui */
 width: 20rem!important;
}

/* Zoom controls */
body.lim-mode.zoom-controls { /* ← spazio qui */
 top: 0.5rem!important;
 left: 0.5rem!important;
 padding: 0.25rem!important;
 gap: 0.25rem!important;
}
body.lim-mode.zoom-btn { /* ← spazio qui */
 width: 1.6rem!important;
 height: 1.6rem!important;
 font-size: 1.2rem!important;
}

/* Tablet touch */
@media (max-width: 1024px) {
 body.lim-mode.sidebar {
 width: 14rem!important;
 min-width: 220px!important;
 }
 body.lim-mode #app-header { height: 3.5rem!important; }
 body.lim-mode.btn {
 padding: 0.9rem 1.4rem!important;
 font-size: 1.2rem!important;
 }
 body.lim-mode.zoom-btn {
 width: 2rem!important;
 height: 2rem!important;
 font-size: 1.4rem!important;
 }
}
/* assets/css/style.css — in fondo */
/* Pulsante LIM: dimensioni e bordo come.basemap-toggle */
#limBtn {
 padding: 6px 14px;
 background: #1e293b;
 border: 2px solid var(--accent-blue);
 border-radius: 20px;
 color: var(--text-primary);
 font-family: var(--font-main);
 font-size: 0.85rem;
 font-weight: 600;
 text-transform: uppercase;
 cursor: pointer;
 display: flex;
 align-items: center;
 justify-content: center;
 backdrop-filter: blur(8px);
 transition: all 0.2s ease;
}

#limBtn:hover {
 color: #fff;
 background: rgba(59, 130, 246, 0.2);
}

#limBtn:active,
#limBtn.active {
 background: var(--accent-blue);
 color: #fff;
 font-weight: 700;
 box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}
/* assets/css/style.css */

/* ============ PULSANTI ON/OFF LAYER ATTIVI ============ */
.layer-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 15px;
    margin-bottom: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-left: 4px solid #3b82f6;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.2s;
    text-align: left;
    font-family: var(--font-main);
}

.layer-toggle-btn:hover {
    background: var(--bg-tertiary, #1e293b);
}

.layer-toggle-btn .layer-toggle-label {
    flex: 1;
}

.layer-toggle-btn .layer-toggle-status {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #334155;
    color: #94a3b8;
    transition: background 0.2s, color 0.2s;
    font-family: var(--font-main);
}

.layer-toggle-btn.active .layer-toggle-status {
    background: #3b82f6;
    color: #fff;
}
#measureResultBox { border: 1px solid #b08968 !important; }
#measureText { color: #b08968 !important; }

.info-modal-header {
 display: flex;
 justify-content: space-between;
 align-items: center;
 padding: 16px 24px;
 background: linear-gradient(135deg, #0a1628, #0d1f3a);
 border-bottom: 1px solid #1e3a5f;
 flex-shrink: 0;
}

.info-modal-header h2 {
 margin: 0;
 color: #e2e8f0;
 font-size: 1.2rem;
 font-weight: bold;
 letter-spacing: 0.02em;
}

.info-modal-close {
 background: none;
 border: 1px solid #334155;
 color: #94a3b8;
 font-size: 1.2rem;
 cursor: pointer;
 padding: 5px 14px;
 border-radius: 6px;
 transition: all 0.2s;
 line-height: 1;
}

.info-modal-close:hover {
 background: #1e293b;
 color: #e2e8f0;
 border-color: #0ea5e9;
}
.cape-canaveral-tooltip {
  background: rgba(10, 20, 40, 0.9) !important;
  border: 1px solid #00e5ff !important;
  color: #fff !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.4) !important;
}
.cape-canaveral-tooltip::before {
  border-top-color: #00e5ff !important;
}