/* ============================================================
   STR‑systems — Pannello Unificato (Versione C: sobria)
   ============================================================ */

.str-panel {
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 6px;
    background: #fff;
    padding: 16px;
}

.str-section {
    margin-bottom: 18px;
}

.str-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--str-bordeaux);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.str-layer {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.str-layer:last-child {
    border-bottom: none;
}

.str-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    opacity: 0.9;
}

.str-info {
    flex-grow: 1;
}

.str-name {
    font-size: 0.95rem;
    font-weight: 600;
}

.str-desc {
    font-size: 0.75rem;
    font-family: var(--str-font-mono);
    opacity: 0.7;
}

/* Toggle sobrio */
.str-toggle input {
    display: none;
}

.str-toggle span {
    width: 32px;
    height: 16px;
    background: #ccc;
    border-radius: 20px;
    position: relative;
    display: inline-block;
    cursor: pointer;
    transition: 0.25s;
}

.str-toggle span::after {
    content: "";
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: 0.25s;
}

.str-toggle input:checked + span {
    background: var(--str-blu-idro);
}

.str-toggle input:checked + span::after {
    transform: translateX(16px);
}

/* Layout a due colonne per il pannello STR */
.str-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px 32px;
}

.str-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (max-width: 768px) {
    .str-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   SIMBOLI SEMPLIFICATI — COERENTI CON LA MAPPA
   ============================================================ */

.str-symbol {
    width: 26px;
    height: 20px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ===========================
   BASE
   =========================== */

/* CTR 510 — linea grigia */
.str-symbol[data-symbol="ctr"]::before {
    content: "";
    width: 26px;
    height: 2px;
    background: #999;
    border-radius: 2px;
}

/* Reticolo idrografico — ciano */
.str-symbol[data-symbol="reticolo"]::before {
    content: "";
    width: 26px;
    height: 3px;
    background: #00B5E2;
    border-radius: 2px;
}

/* ===========================
   TECNICI
   =========================== */

/* Viabilità carrabile — grigio topo */
.str-symbol[data-symbol="viabilita"]::before {
    content: "";
    width: 26px;
    height: 3px;
    background: #6E6E6E;
    border-radius: 2px;
}

/* Ponti CTR — giallo + bordo nero */
.str-symbol[data-symbol="ponti"]::before {
    content: "";
    width: 12px;
    height: 12px;
    background: #FFD700;
    border: 2px solid #000;
    border-radius: 50%;
}

/* Attraversamenti — rosso + bordo bianco */
.str-symbol[data-symbol="attraversamenti"]::before {
    content: "";
    width: 12px;
    height: 12px;
    background: #FF4136;
    border: 2px solid #FFF;
    border-radius: 50%;
}

/* ===========================
   INTELLIGENTI
   =========================== */

/* ============================================================
   Attraversamenti classificati — scala cromatica 1–5 (coerente con mappa)
   ============================================================ */

.str-symbol[data-symbol="attr_class"] {
    position: relative;
}

.str-symbol[data-symbol="attr_class"]::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #FFF;
    background: #999; /* fallback */
}

/* Classe 1 — verde */
.str-symbol[data-symbol="attr_class"][data-class="1"]::before {
    background: #4CAF50;
}

/* Classe 2 — verde chiaro */
.str-symbol[data-symbol="attr_class"][data-class="2"]::before {
    background: #8BC34A;
}

/* Classe 3 — giallo */
.str-symbol[data-symbol="attr_class"][data-class="3"]::before {
    background: #FFC107;
}

/* Classe 4 — arancio */
.str-symbol[data-symbol="attr_class"][data-class="4"]::before {
    background: #FF9800;
}

/* Classe 5 — rosso */
.str-symbol[data-symbol="attr_class"][data-class="5"]::before {
    background: #F44336;
}


/* Viabilità critica — gialla */
.str-symbol[data-symbol="viab_critica"]::before {
    content: "";
    width: 26px;
    height: 6px;
    background: #FFDC00;
    border-radius: 3px;
}

/* ===========================
   GOVERNO
   =========================== */

/* Priorità intervento — scala completa */
.str-symbol[data-symbol="priorita"]::before {
    content: "";
    width: 26px;
    height: 6px;
    background: linear-gradient(90deg,
        #2ECC40,  /* verde */
        #FFDC00,  /* giallo */
        #FF851B,  /* arancio */
        #FF4136,  /* rosso */
        #85144b   /* bordeaux */
    );
    border-radius: 3px;
}

/* ============================================================
   Sintesi territoriale — scala cromatica A–E (coerente con mappa)
   ============================================================ */

.str-symbol[data-symbol="sintesi"] {
    position: relative;
}

.str-symbol[data-symbol="sintesi"]::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 2px solid #333;
    background: #999; /* fallback */
}

/* Classe A — rosso */
.str-symbol[data-symbol="sintesi"][data-class="A"]::before {
    background: rgb(244, 67, 54);
}

/* Classe B — arancio */
.str-symbol[data-symbol="sintesi"][data-class="B"]::before {
    background: rgb(255, 152, 0);
}

/* Classe C — giallo */
.str-symbol[data-symbol="sintesi"][data-class="C"]::before {
    background: rgb(255, 235, 59);
}

/* Classe D — verde chiaro */
.str-symbol[data-symbol="sintesi"][data-class="D"]::before {
    background: rgb(139, 195, 74);
}

/* Classe E — verde */
.str-symbol[data-symbol="sintesi"][data-class="E"]::before {
    background: rgb(76, 175, 80);
}


.str-scale {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
    align-items: center;
}



/* ------------------------------ */
/* BARRA INFERIORE RESPONSIVE     */
/* ------------------------------ */

#smart-bottom {
    position: fixed;               /* fondamentale */
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;

    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;

    width: 90%;
    max-width: 1100px;

    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ------------------------------ */
/* BARRA LATERALE DESTRA          */
/* ------------------------------ */

#smart-tools {
    position: fixed;
    top: 140px;
    right: 20px;
    z-index: 9999;

    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ------------------------------ */
/* PULSANTI SMART                 */
/* ------------------------------ */

.smart-btn,
.smart-btn-bottom {
    display: flex;
    align-items: center;
    justify-content: flex-start;

    background: #ffffff;
    border: 1px solid #d0d0d0;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;

    font-size: 14px;
    font-weight: 500;
    color: #333;

    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
    transition: all 0.2s ease;
}

.smart-btn:hover,
.smart-btn-bottom:hover {
    background: #f5f5f5;
    border-color: #bcbcbc;
}

/* ------------------------------ */
/* ICONE SVG                      */
/* ------------------------------ */

.smart-icon {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    opacity: 0.85;
}

/* ------------------------------ */
/* PULSANTI VISIONARI (DISABLED)  */
/* ------------------------------ */

.smart-btn-bottom.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    border-style: dashed;
    border-color: #999;
}

.smart-btn-bottom.disabled .smart-icon {
    opacity: 0.45;
}

.smart-btn-bottom.disabled:hover {
    background: #ffffff;
}


.smart-btn.active,
.smart-btn-bottom.active {
    background-color: #005eff;
    color: #fff;
    border-color: #005eff;
}

.smart-btn.active img,
.smart-btn-bottom.active img {
    filter: brightness(0) invert(1);
}


#smart-tools .tooltip,
#smart-bottom .tooltip {
    z-index: 999999 !important;
}


.tooltip {
    position: relative;
    z-index: 999999999 !important;
}

/* ----------------------------------------------------
   VERSIONE PREMIUM — STR‑systems
   ---------------------------------------------------- */

/* WRAPPER MAPPA */
.str-map-wrapper {
    position: relative;
    margin-bottom: 2rem;
}

/* MAPPA */
.str-map {
    width: 100%;
    height: 600px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 18px rgba(0,0,0,0.12);
}

/* PULSANTI LATERALI (SMART) */
.smart-tools {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.smart-btn {
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(0,0,0,0.08);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: all 0.15s ease;
}

.smart-btn:hover {
    background: white;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

/* PULSANTI INFERIORI (SMART + VISIONARI) */
.smart-bottom {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 92%;
}

.smart-btn-bottom {
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(0,0,0,0.08);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: all 0.15s ease;
}

.smart-btn-bottom.disabled {
    opacity: 0.55;
    cursor: default;
}

.smart-btn-bottom:hover:not(.disabled) {
    background: white;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

/* POPUP PREMIUM */
.ol-popup {
    background: rgba(255,255,255,0.96);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
    max-width: 320px;
}

/* RESPONSIVE */
@media (max-width: 768px) {

    .smart-tools {
        flex-direction: row;
        top: auto;
        bottom: 130px;
        right: 50%;
        transform: translateX(50%);
    }

    .smart-bottom {
        bottom: 12px;
        max-width: 95%;
    }

    .str-map {
        height: 480px;
    }
}
