/* ============================================================
   CIE – I Numeri della CIE  |  cie-numeri.css  v1.3
   Fedele al Sistema di Design Gov.it (Bootstrap Italia 2.x)
   Font: Titillium Web | Colori istituzionali
   ============================================================ */

:root {
    --cie-blue-dark: #17324D;
    --cie-blue: #0066CC;
    --cie-blue-mid: #1A5FAD;
    --cie-blue-light: #E8F1FC;
    --cie-border: #D9E6F2;
    --cie-bg: #F5F7FA;
    --cie-card-bg: #FFFFFF;
    --cie-text: #17324D;
    --cie-muted: #5A7184;
    --cie-radius: 4px;
    --cie-shadow: 0 2px 10px rgba(23, 50, 77, .08);
    --font: 'Titillium Web', 'Helvetica Neue', Arial, sans-serif;
}

.cie-page *, .cie-widget-numeri *,
.cie-page *::before, .cie-page *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ═══ WIDGET NUMERI ════════════════════════════════════════ */
.cie-widget-numeri {
    font-family: var(--font);
    color: var(--cie-text);
    max-width: 100%;
}

.cie-widget-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

.cie-widget-title {
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 700;
    color: var(--cie-blue-dark);
    line-height: 1.2;
}

.cie-widget-link {
    font-size: 13px;
    font-weight: 700;
    color: var(--cie-blue);
    text-decoration: none;
    letter-spacing: .04em;
    white-space: nowrap;
    transition: color .2s;
}

.cie-widget-link:hover {
    color: var(--cie-blue-dark);
}

.cie-widget-link span {
    font-size: 16px;
    margin-left: 4px;
}

.cie-widget-card {
    background: var(--cie-card-bg);
    border: 1px solid var(--cie-border);
    border-radius: var(--cie-radius);
    box-shadow: var(--cie-shadow);
    display: flex;
    align-items: stretch;
    padding: 32px 0;
}

.cie-widget-kpi {
    flex: 1;
    padding: 0 32px;
    min-width: 0;
}

.cie-widget-divider {
    width: 1px;
    background: var(--cie-border);
    flex-shrink: 0;
}

.cie-widget-val {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 700;
    color: var(--cie-blue);
    line-height: 1.05;
    margin-bottom: 8px;
}

.cie-widget-lbl {
    font-family: var(--font);
    font-style: normal;
    font-size: 25px;
    font-weight: 600;
    line-height: 48px;
    color: #171717;
    margin-bottom: 6px;
    text-align: center;
}

.cie-widget-desc {
    font-family: var(--font);
    font-style: normal;
    font-size: 18px;
    font-weight: 400;
    line-height: 24px;
    color: #556475;
    text-align: left;
}

@media (max-width: 640px) {
    .cie-widget-card {
        flex-direction: column;
        padding: 0;
    }

    .cie-widget-kpi {
        padding: 20px 24px;
    }

    .cie-widget-divider {
        width: auto;
        height: 1px;
    }
}

/* ═══ PAGINA COMPLETA ══════════════════════════════════════ */
.cie-page {
    font-family: var(--font);
    color: var(--cie-text);
    /*background: var(--cie-bg); */
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    overflow-x: clip;
}

.cie-page-title-row {
    display: flex;
    /*align-items: flex-start;*/
    /*justify-content: space-between;*/
    /*gap: 24px;*/
    /*flex-wrap: wrap;*/
    /*padding: 16px 0 32px;*/
    /*border-bottom: 1px solid var(--cie-border);*/
    /*margin-bottom: 32px;*/
}

.cie-page-title {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    color: var(--cie-blue-dark);
    line-height: 1.2;
}

.cie-aggiornamento-box {
    background: #d9e6f2;
    border-radius: var(--cie-radius);
    padding: 20px 24px;
    color: #17324d;
    max-width: 380px;
    /*margin-left: auto;*/
    /*margin-bottom: 24px;*/
    box-shadow: var(--cie-shadow);
}

.cie-aggiornamento-date {
    font-size: 15px;
    margin-bottom: 12px;
    line-height: 1.3;
}

.cie-aggiornamento-date strong {
    display: block;
    font-size: 22px;
    font-weight: 700;
    margin-top: 2px;
}

.cie-aggiornamento-info {
    font-size: 13px;
    line-height: 1.5;
    opacity: .9;
    margin-bottom: 10px;
}

.cie-aggiornamento-info strong {
    font-weight: 700;
}

.cie-aggiornamento-opendata {
    font-size: 13px;
    opacity: .9;
}

.cie-aggiornamento-opendata a {
    color: #fff;
    font-weight: 700;
    text-decoration: underline;
}

.cie-aggiornamento-opendata a:hover {
    opacity: .8;
}

.cie-opendata-box {
    background: var(--cie-blue-light);
    border: 1px solid var(--cie-border);
    border-radius: var(--cie-radius);
    padding: 12px 16px;
}

.cie-opendata-box p {
    font-size: 13px;
    color: var(--cie-muted);
    margin-bottom: 6px;
    line-height: 1.4;
}

.cie-link-opendata {
    font-size: 14px;
    font-weight: 600;
    color: var(--cie-blue);
    text-decoration: underline;
}

.cie-section {
    margin-bottom: 48px;
}

.cie-section-title {
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 700;
    color: var(--cie-blue-dark);
    margin-bottom: 24px;
    padding-bottom: 8px;
    /*border-bottom: 2px solid var(--cie-border);*/
}

.cie-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.cie-kpi-row--2col {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
    .cie-kpi-row {
        grid-template-columns: 1fr!important;
    }
    .page-template-page-fullwidth .cie-page-header{position:static!important;margin:33px auto 0 auto}
    .cie-kpi-label{line-height:33px!important;padding:7px 0}
}

.cie-kpi-box {
    background: var(--cie-card-bg);
    border: 1px solid var(--cie-border);
    border-top: 3px solid var(--cie-border);
    border-radius: var(--cie-radius);
    padding: 20px 16px 16px;
    box-shadow: var(--cie-shadow);
    text-align: center;
}

.cie-kpi-box.cie-kpi-accent {
    border-top-color: var(--cie-blue);
}

.cie-kpi-value {
    /*font-size: clamp(24px, 3.5vw, 36px);*/
    font-weight: 700;
    color: var(--cie-blue);
    line-height: 1.1;
    margin-bottom: 4px;
    font-size: 44px;
}

.cie-kpi-box.cie-kpi-accent .cie-kpi-value {
    font-size: clamp(28px, 4vw, 42px);
}

.cie-kpi-label {
    font-family: var(--font);
    font-style: normal;
    font-size: 25px;
    font-weight: 600;
    line-height: 48px;
    color: #171717;
    margin-bottom: 6px;
    text-align: center;
}

.cie-kpi-desc {
    font-family: var(--font);
    font-style: normal;
    font-size: 17px;
    font-weight: 400;
    line-height: 24px;
    color: #556475;
}

.cie-kpi-center {
    text-align: center;
}

.cie-card {
    background: var(--cie-card-bg);
    border: 1px solid var(--cie-border);
    border-radius: var(--cie-radius);
    padding: 24px;
    box-shadow: var(--cie-shadow);
    margin-bottom: 24px;
}

.cie-card-title {
    /*font-size: 16px;*/
    /*font-weight: 700;*/
    /*color: var(--cie-text);*/
    /*margin-bottom: 4px;*/
    font-family: var(--font);
    font-style: normal;
    font-size: 25px;
    font-weight: 600;
    line-height: 48px;
    color: #171717;
    margin-bottom: 6px;
    text-align: left;
}

.cie-card-subtitle {
    font-family: var(--font);
    font-style: normal;
    font-size: 18px;
    font-weight: 400;
    line-height: 24px;
    color: #556475;
    margin-bottom: 20px;
}

.cie-sp-total-card {
    text-align: center;
    padding: 32px 24px;
}

.cie-sp-total-card .cie-kpi-value {
    font-size: clamp(36px, 5vw, 52px);
}

/* ═══ MAPPA ════════════════════════════════════════════════ */
.cie-map-card {
    overflow: visible;
    /* Padding generoso per dare respiro alla mappa */
    padding: 48px 24px 20px;
}

.cie-map-layout {
    display: flex;
    align-items: flex-start;
    gap: 40px;
}

/* Colonna sinistra: percentuali per area */
.cie-area-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 130px;
    flex-shrink: 0;
    padding-top: 16px;
}

.cie-area-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--cie-border);
}

.cie-area-item:last-child {
    border-bottom: none;
}

.cie-area-pct {
    display: block;
    font-size: clamp(24px, 2.8vw, 32px);
    font-weight: 700;
    color: var(--cie-blue);
    line-height: 1;
}

.cie-area-estero .cie-area-pct {
    color: var(--cie-muted);
    font-size: clamp(18px, 2vw, 24px);
}

.cie-area-name {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--cie-muted);
    letter-spacing: .09em;
    margin-top: 4px;
}

/* Colonna destra: mappa + legenda */
.cie-map-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

/* Contenitore Leaflet – sfondo bianco puro, nessun bordo/colore */
.cie-map-container {
    width: 100%;
    height: 460px; /* più alto per dare più respiro */
    border-radius: 0; /* nessun bordo arrotondato sulla mappa */
    overflow: visible;
    background: #ffffff; /* bianco puro – nessun sfondo colorato */
}

/* Legenda orizzontale sotto la mappa, allineata a destra */
.cie-map-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.cie-legend-label {
    font-size: 12px;
    color: var(--cie-muted);
    font-weight: 600;
}

.cie-legend-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.cie-legend-gradient {
    width: 120px;
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(to right, #C8DAEA 0%, #0B3D91 100%);
}

.cie-legend-ticks {
    display: flex;
    justify-content: space-between;
    width: 120px;
    font-size: 11px;
    color: var(--cie-muted);
}

/* Tooltip Leaflet – stile navy esatto del mockup */
.leaflet-tooltip.cie-map-tooltip {
    background: #17324D !important;
    color: #fff !important;
    font-family: 'Titillium Web', sans-serif !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    padding: 10px 14px !important;
    border-radius: 4px !important;
    border: none !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .3) !important;
    line-height: 1.3 !important;
    white-space: nowrap;
}

.leaflet-tooltip.cie-map-tooltip .cie-tt-name {
    display: block;
    font-size: 13px;
    font-weight: 400;
    opacity: .9;
    margin-bottom: 2px;
}

.leaflet-tooltip.cie-map-tooltip .cie-tt-pct {
    display: block;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
}

.leaflet-tooltip.cie-map-tooltip::before,
.leaflet-tooltip.cie-map-tooltip::after {
    display: none !important;
}

/* Mobile mappa */
@media (max-width: 768px) {
    .cie-map-layout {
        flex-direction: column;
    }

    .cie-area-list {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        min-width: unset;
        padding-top: 0;
    }

    .cie-area-item {
        width: calc(50% - 4px);
        padding: 10px 0;
    }

    .cie-area-item:nth-child(even) {
        padding-left: 16px;
    }

    .cie-map-container {
        height: 320px;
    }

    .cie-map-right {
        width: 100%;
    }
}

/* ═══ GRAFICI ══════════════════════════════════════════════ */
.cie-chart-wrap {
    position: relative;
}

/* Altezze aumentate per dare più respiro alle barre */
.cie-chart-eta-wrap {
    height: 300px;
}

/* era 240 */
.cie-chart-linea-wrap {
    height: 280px;
}

.cie-chart-sp-wrap {
    height: 480px;
}

/* era 400 */

@media (max-width: 600px) {
    .cie-chart-eta-wrap {
        height: 340px;
    }

    .cie-chart-linea-wrap {
        height: 220px;
    }

    .cie-chart-sp-wrap {
        height: 560px;
    }
}

/* ═══ ANIMAZIONI ═══════════════════════════════════════════ */
@keyframes cie-fadein {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cie-section {
    animation: cie-fadein .5s ease both;
}

#cie-utilizzo {
    animation-delay: .1s;
}

#cie-service-provider {
    animation-delay: .2s;
}

.page-template-page-fullwidth article{position:relative}
.page-template-page-fullwidth .entry-content{position:static}
.page-template-page-fullwidth .cie-page-header{position:absolute;top:0px;right:0px;width:328px}
.page-template-page-fullwidth .cie-page-header .cie-page-title-row{display:block}
.page-template-page-fullwidth .cie-page-header .cie-page-title-row .cie-aggiornamento-box{
    background:#F0F6FC;
    padding:16px;
    border-radius:16px;
    box-shadow:none;
}
.page-template-page-fullwidth .cie-aggiornamento-date{margin-bottom:0;font-size:18px;line-height:24px;display:flex;align-items:center}
.page-template-page-fullwidth .cie-aggiornamento-date svg{width:20px;height:20px;fill:#435A70}
.page-template-page-fullwidth .cie-aggiornamento-date strong{display:inline-block;padding-left:5px;padding:0 10px}
