:root {
    --bs-font-sans-serif: "Titillium Web", Geneva, Tahoma, sans-serif;
    --bs-font-serif: "Lora", Georgia, "Times New Roman", serif;
    --bs-font-monospace: "Roboto Mono", Monaco, Consolas, "Courier New", monospace;
}

body {
    font-family: var(--bs-font-sans-serif);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: "Titillium Web", sans-serif;
}

main {
    overflow-x: hidden;
}

.btn-outline-primary:hover {
    background-color: #0066CC;
    color: #fff;
}

.btn-outline-primary:hover .icon {
    fill: #fff !important;
}

.section-overline {
    display: inline-block;
    text-transform: uppercase;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #0066CC;
    margin-bottom: .5rem;
}

.section-title {
    font-weight: 700;
    color: #17324d;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.hero-section {
    position: relative;
    min-height: 85vh;
    display: flex;
    align-items: center;
    background: url('../images/black.jpg') center center / cover no-repeat;
    overflow: hidden;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
            rgba(0, 50, 100, .78) 0%,
            rgba(0, 102, 204, .45) 50%,
            rgba(0, 50, 100, .65) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.15;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    color: rgba(255, 255, 255, .92);
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.hero-text {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, .85);
    line-height: 1.7;
    max-width: 600px;
}

.section-progetto {
    background-color: #fff;
}

.section-progetto .lead {
    color: #17324d;
}

.numeri-chiave {
    border-top: 1px solid #e6ebf2;
    margin-top: 3rem !important;
    padding-top: 2rem;
}

.numero-card {
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    height: 100%;
}

.numero-card .icon {
    width: 32px;
    height: 32px;
    margin-bottom: 1.25rem;
    color: var(--bs-primary);
}

.numero-valore {
    display: block;
    font-size: 3.25rem;
    font-weight: 800;
    color: var(--bs-primary);
    line-height: 0.9;
    margin-bottom: 0.75rem;
    font-family: "Titillium Web", sans-serif;
    letter-spacing: -0.02em;
}

.numero-label {
    display: block;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #455b71;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08rem;
    padding: 0 10%;
}

.section-importanza {
    background: linear-gradient(180deg, #f0f6fc 0%, #ffffff 100%);
}

.section-importanza .lead {
    color: #455b71;
}

/* Cards */
.card-importanza {
    border: none;
    border-radius: 12px !important;
    transition: transform .25s ease, box-shadow .25s ease;
    overflow: hidden;
}

.card-icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #e8f0fe, #d0e2fe);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-importanza .card-title {
    font-weight: 700;
    color: #17324d;
}

.card-importanza .card-text {
    color: #5c6f82;
    font-size: .925rem;
    line-height: 1.6;
}

/* ═══════════════ RESPONSIVE ═══════════════ */
@media (max-width: 768px) {
    .hero-section {
        min-height: 70vh;
    }

    .numero-valore {
        font-size: 1.5rem;
    }

    .numero-label {
        font-size: .78rem;
    }
}

@media (min-width: 992px) {
    .it-header-slim-wrapper .it-header-slim-wrapper-content a.dropdown-toggle .icon {
        margin-left: 0px !important;
    }
}

/* ═══════════════ NAV ═══════════════ */
.nav-link {
    font-size: 18px;
}

/* ═══════════════ FOOTER ═══════════════ */
a,
.it-footer-main .link-list-wrapper ul li a:not(.disabled) {
    text-decoration: none !important;
    list-style-type: none !important;
}

.link-list-wrapper li::marker {
    content: none;
}

/* ═══════════════ LOGO SLIDER ═══════════════ */

.logo-slider-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 10px 0;
}

.logo-slider-track {
    display: flex;
    width: max-content;
    will-change: transform;
    gap: 20px;
}

.logo-slide {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-content {
    width: 100%;
}

.logo-slide img {
    display: block;
    height: 75px;
    width: auto;
    object-fit: contain;
    scale: 1;
    transition: all 0.3s ease-in-out;
}

.logo-slide img:hover {
    scale: 1.1;
    transition: all 0.3s ease-in-out;
}

.logo-slide span {
    font-size: 0.7rem;
    font-weight: 500;
    display: block;
    margin-top: 6px;
}

/* --- News Basics --- */
.card-news {
    border: 1px solid #e6ebf2 !important;
    border-radius: 8px !important;
    background: #fff;
    height: 100%;
    transition: box-shadow 0.2s ease;
}

.card-news:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-news .card-img-top {
    border-radius: 8px 8px 0 0;
    height: 180px;
    object-fit: cover;
}

.card-news .card-title {
    font-weight: 700;
    color: #17324d;
    margin-bottom: 0.5rem;
}

.news-meta {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.75rem;
}

.card::after {
    display: none !important;
}

/* ─── Article Body Styles ─── */
.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.article-body iframe {
    max-width: 100%;
    border-radius: 8px;
    margin: 1.5rem 0;
}

/* ─── Layout ─── */
.gis-wrapper {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
}

/* ─── Floating Toolbar ─── */
#gis-toolbar {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gis-tb-btn {
    width: 40px;
    height: 40px;
    background: #fff;
    border: 1px solid #d1d1d1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
    transition: all .2s ease;
    position: relative;
    padding: 0;
}

.gis-tb-btn svg.icon {
    fill: #0066cc;
    transition: fill .18s;
}

.gis-tb-btn:hover {
    background: #f0f7ff;
    border-color: #0066cc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}

.gis-tb-btn.active {
    background: #eef5ff;
    border: 2px solid #0066cc;
    box-shadow: 0 2px 10px rgba(0, 102, 204, .2);
}

.gis-tb-btn.active svg.icon {
    fill: #0066cc;
}

.gis-tb-btn.inactive {
    opacity: 0.5;
    border-style: dashed;
}

/* ─── Group (pulsante + dropdown) ─── */
.gis-tb-group {
    position: relative;
}

/* ─── Dropdown generico ─── */
.gis-tb-dropdown {
    display: none;
    position: absolute;
    left: 50px;
    top: 0;
    min-width: 190px;
    background: #fff;
    border: 1px solid #d6d6d6;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .14);
    padding: 12px 14px;
    z-index: 100;
    animation: tbDropIn .15s ease;
}

.gis-tb-dropdown.open {
    display: block;
}

@keyframes tbDropIn {
    from {
        opacity: 0;
        transform: translateX(-6px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.gis-tb-dropdown-title {
    font-size: .7rem;
    font-weight: 700;
    color: #5a6a7b;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 0 0 8px;
}

.gis-tb-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    color: #17324d;
    padding: 5px 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: background .12s;
    user-select: none;
}

.gis-tb-dropdown-item:hover {
    background: #f0f6ff;
}

.gis-tb-dropdown-item input[type="checkbox"] {
    accent-color: #06c;
    cursor: pointer;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

#poly-opacity-slider {
    height: 6px;
    border-radius: 5px;
    background: #e0e8f0;
    outline: none;
    accent-color: #0066cc;
}

#poly-opacity-slider::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #0066cc;
    cursor: pointer;
}

.gis-danger-dot {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    flex-shrink: 0;
    display: inline-block;
}

/* ─── Info dropdown (più largo) ─── */
.gis-tb-dropdown-info {
    min-width: 220px;
}

.gis-tb-status-text {
    font-size: .82rem;
    color: #17324d;
    margin-bottom: 4px;
}

.gis-tb-legend {
    font-size: .78rem;
    color: #5c6f82;
    padding-left: 16px;
    margin: 6px 0 0;
    line-height: 1.7;
}

/* ─── Pannello Layer – rimosso, stili neutralizzati ─── */
.gis-panel,
.gis-panel-header,
.gis-panel-body,
.gis-layer-item,
.gis-layer-dot {
    display: none !important;
}

/* ─── Mappa ─── */
.gis-map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#gis-map {
    width: 100%;
    height: 100%;
    display: block;
}

/* .gis-toggle-btn rimosso (sostituito dalla toolbar) */

/* ─── Sidebar dettaglio poligono ─── */
#gis-sidebar {
    position: absolute;
    top: 20px;
    right: -420px;
    width: 360px;
    height: fit-content;
    max-height: calc(100% - 40px);
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    transition: right .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    border: 1px solid #e0e8f0;
    overflow: hidden;
}

#gis-sidebar.open {
    right: 20px;
}

.gis-sidebar-header {
    background: #fff;
    color: #17324d;
    padding: 18px 18px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid #e0e8f0;
}

.gis-sidebar-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #17324d;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.gis-sidebar-close {
    background: none;
    border: none;
    color: #a0aab5;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.gis-sidebar-close:hover {
    color: #17324d;
}

.gis-sidebar-close svg.icon {
    fill: currentColor;
    width: 24px;
    height: 24px;
}

.gis-sidebar-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.gis-prop-label {
    font-size: .75rem;
    font-weight: 600;
    color: #5a5a5a;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
    margin-top: 14px;
}

.gis-prop-value {
    font-size: .9rem;
    color: #111;
    background: #f5f7fb;
    border-radius: 4px;
    padding: 8px 12px;
    word-break: break-word;
}

.gis-raw-data {
    font-size: 11px;
    background: #f5f5f5;
    border-radius: 4px;
    padding: 10px;
    white-space: pre-wrap;
    border: 1px solid #e0e0e0;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 8px;
    font-family: monospace;
}

/* ─── Loading overlay ─── */
#gis-loader {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    gap: 14px;
    font-weight: 600;
    color: #06c;
    font-size: .95rem;
}

.gis-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #d6e8ff;
    border-top-color: #06c;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ─── Basemap selector ─── */
#gis-basemap-ctrl {
    position: absolute;
    bottom: 36px;
    right: 12px;
    z-index: 20;
    display: flex;
    gap: 4px;
    background: #fff;
    border: 1px solid #d1d1d1;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}

.gis-bm-btn {
    border: none;
    background: transparent;
    border-radius: 5px;
    font-size: .72rem;
    font-weight: 600;
    color: #555;
    padding: 4px 10px;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.gis-bm-btn:hover {
    background: #f0f6ff;
    color: #0066cc;
}

.gis-bm-btn.active {
    background: #0066cc;
    color: #fff;
}

/* ─── Geological legend ─── */
#gis-geo-legend {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 4px;
}

.gis-legend-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 0;
    font-size: .73rem;
    color: #17324d;
}

.gis-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, .15);
}

.gis-legend-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── MapLibre control overrides ─── */
.maplibregl-ctrl-group {
    border-radius: 8px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12) !important;
}

.maplibregl-ctrl-attrib {
    font-size: 10px !important;
    background: rgba(255, 255, 255, .75) !important;
}

@media (max-width: 768px) {

    /* Toolbar più compatta su mobile */
    #gis-toolbar {
        top: 8px;
        left: 8px;
        gap: 5px;
    }

    .gis-tb-btn {
        width: 36px;
        height: 36px;
    }

    /* Dropdown a destra del pulsante, ma non fuori schermo */
    .gis-tb-dropdown {
        left: 46px;
        min-width: 170px;
    }

    #gis-sidebar {
        width: calc(100% - 30px);
        right: -120%;
    }

    #gis-sidebar.open {
        right: 15px;
    }
}


/* ═══════════════════════════════════════════════════════════
   GIS SIDEBAR – 4 TAB (Dati / Meteo / Grafici / Storico)
═══════════════════════════════════════════════════════════ */

/* ─── Tab Nav ─── */
.gis-tab-nav {
    background: #f8fafc;
    border-bottom: 2px solid #e0e8f0;
    flex-shrink: 0;
}

.gis-tab-nav .nav-tabs {
    border-bottom: none;
    gap: 0;
    flex-wrap: nowrap;
}

.gis-tab-nav .nav-item {
    flex: 1;
}

.gis-tab-nav .nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 600;
    color: #5c6f82;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 10px 6px;
    transition: color .2s, border-color .2s, background .2s;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.gis-tab-nav .nav-link:hover {
    color: #0066cc;
    background: #eef4fb;
}

.gis-tab-nav .nav-link.active {
    color: #0066cc;
    border-bottom-color: #0066cc;
    background: #fff;
}

.gis-tab-nav .nav-link svg.icon {
    fill: currentColor;
    flex-shrink: 0;
}

/* ─── Tab Content & Body ─── */
.gis-tab-content {
    padding: 0;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gis-tab-pane {
    display: none;
    padding: 16px 18px 24px;
    overflow-y: auto;
    flex: 1;
}

.gis-tab-pane.active {
    display: block;
}

/* ─── TAB 1: Dati – KV Rows ─── */
.gis-kv-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f4f8;
}

.gis-kv-row:last-child {
    border-bottom: none;
}

.gis-kv-label {
    font-size: .75rem;
    font-weight: 600;
    color: #5a6a7b;
    text-transform: uppercase;
    letter-spacing: .4px;
    flex-shrink: 0;
    max-width: 48%;
}

.gis-kv-value {
    font-size: .88rem;
    color: #17324d;
    text-align: right;
    word-break: break-word;
}

.gis-kv-value.badge-pk {
    background: #e8f0fe;
    color: #0066cc;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .8rem;
}

/* ─── TAB 2: Meteo – Cards ─── */
.gis-meteo-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gis-meteo-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid #e0e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    transition: box-shadow .2s;
}

.gis-meteo-card:hover {
    box-shadow: 0 2px 8px rgba(0, 102, 204, .1);
    border-color: #c5d8f0;
}

.gis-meteo-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gis-meteo-icon svg.icon {
    fill: currentColor;
    width: 22px;
    height: 22px;
}

.gis-meteo-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gis-meteo-label {
    font-size: .73rem;
    font-weight: 600;
    color: #6c7e8e;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.gis-meteo-value {
    font-size: 1.15rem;
    font-weight: 700;
    font-family: "Titillium Web", sans-serif;
}

.gis-meteo-arrow {
    fill: #b0bec5;
    flex-shrink: 0;
}

.gis-update-note {
    font-size: .72rem;
    color: #9aa5b1;
    text-align: right;
    margin-top: 10px;
    margin-bottom: 0;
}

/* ─── TAB 3: Grafici – Chart blocks ─── */
.gis-chart-block {
    background: #fff;
    border: 1px solid #e0e8f0;
    border-radius: 8px;
    padding: 12px 14px 10px;
    margin-bottom: 14px;
}

.gis-chart-block:last-child {
    margin-bottom: 0;
}

.gis-chart-title {
    font-size: .73rem;
    font-weight: 700;
    color: #455b71;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 10px;
}

/* ─── TAB 4: Storico – Tabella ─── */
.gis-storico-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e0e8f0;
    margin-bottom: 10px;
}

.gis-storico-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .78rem;
    min-width: 300px;
}

.gis-storico-table thead tr {
    background: #0066cc;
    color: #fff;
}

.gis-storico-table th {
    padding: 8px 10px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
    letter-spacing: .3px;
}

.gis-storico-table tbody tr {
    border-bottom: 1px solid #f0f4f8;
    transition: background .15s;
}

.gis-storico-table tbody tr:last-child {
    border-bottom: none;
}

.gis-storico-table tbody tr:hover {
    background: #f0f6ff;
}

.gis-storico-table td {
    padding: 7px 10px;
    color: #17324d;
    white-space: nowrap;
}

#gis-map-tooltip {
    position: fixed;
    z-index: 2999;
    pointer-events: none;
    display: none;
    min-width: 180px;
    max-width: 260px;
    background: #ffffff;
    border: 1px solid #d6d6d6;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
    color: #17324d;
    font-size: 13px;
    line-height: 1.5;
    animation: gis-tt-fadein 0.15s ease;
}

@keyframes gis-tt-fadein {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#gis-map-tooltip.visible {
    display: block;
}

.gis-tt-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eef5ff;
}

.gis-tt-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #ccc;
}

.gis-tt-name {
    font-size: 14px;
    font-weight: 700;
    color: #0066cc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gis-tt-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gis-tt-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.gis-tt-label {
    color: #5a6a7b;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.gis-tt-value {
    color: #17324d;
    font-size: 13px;
    font-weight: 500;
    text-align: right;
}