/* ============================================================
   Silstat — sezione /osservatorio (restyling 2026-05)
   ============================================================ */

/* -----------------------------------------------
   LAYOUT SIDEBAR + MAIN
   ----------------------------------------------- */
.silstat-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0;
    min-height: 60vh;
}

.silstat-sidebar {
    width: 240px;
    min-width: 220px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-right: 1px solid #e2e8f0;
    padding: 1.5rem 1rem;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
}

.silstat-sidebar-title {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #8a9bb0;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid #e2e8f0;
}

.silstat-main {
    flex-grow: 1;
    padding: 1.5rem 2rem;
    overflow-x: auto;
    min-width: 0;
    background: #fff;
}

/* -----------------------------------------------
   KPI CARDS
   ----------------------------------------------- */
.kpi-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: .75rem;
    padding: 1.25rem;
    text-align: center;
    height: 100%;
    transition: box-shadow .25s, transform .2s, border-color .2s;
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    box-shadow: 0 10px 28px rgba(0,0,0,.08);
    transform: translateY(-2px);
    border-color: #c0cfe0;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0066cc, #2a9d8f);
    opacity: .8;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: #003366;
    line-height: 1.15;
    letter-spacing: -.02em;
}

.kpi-label {
    font-size: .8rem;
    color: #6c757d;
    margin-top: .35rem;
    font-weight: 500;
}

.kpi-delta {
    font-size: .85rem;
    font-weight: 700;
    margin-top: .35rem;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: #f8fafc;
}
.kpi-delta.positive { color: #1e7e34; }
.kpi-delta.negative { color: #c0392b; }

/* -----------------------------------------------
   GRAFICI
   ----------------------------------------------- */
.chart-container {
    position: relative;
    height: 340px;
    background: #fafbfc;
    border: 1px solid #eef2f6;
    border-radius: .6rem;
    padding: .75rem;
}

.chart-title {
    font-size: .9rem;
    font-weight: 700;
    color: #1a2b3c;
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.chart-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, #0066cc, #2a9d8f);
    border-radius: 2px;
}

/* -----------------------------------------------
   TABELLE
   ----------------------------------------------- */
.silstat-table {
    font-size: .875rem;
    border-radius: .5rem;
    overflow: hidden;
}
.silstat-table thead th {
    background: #f1f5f9;
    color: #4a5568;
    font-weight: 700;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 2px solid #e2e8f0;
    padding: .65rem .75rem;
}
.silstat-table tbody td {
    padding: .6rem .75rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.silstat-table tbody tr:hover td {
    background: #f8fafc;
}

/* -----------------------------------------------
   EXPORT
   ----------------------------------------------- */
.export-links {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.export-links a {
    font-size: .82rem;
    font-weight: 600;
    color: #5c6f82;
    text-decoration: none;
    padding: .35rem .7rem;
    border: 1px solid #e2e8f0;
    border-radius: .35rem;
    background: #fff;
    transition: all .15s;
}
.export-links a:hover {
    color: #0066cc;
    border-color: #0066cc;
    background: #f0f7ff;
}

/* -----------------------------------------------
   STATO VUOTO
   ----------------------------------------------- */
.silstat-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #8a9bb0;
    background: #fafbfc;
    border-radius: .6rem;
    border: 1px dashed #e2e8f0;
}
.silstat-empty .empty-icon {
    opacity: .4;
    margin-bottom: 1rem;
}
.silstat-empty .empty-title {
    font-weight: 700;
    color: #5c6f82;
    font-size: 1rem;
    margin-bottom: .25rem;
}
.silstat-empty .empty-text {
    font-size: .9rem;
    max-width: 400px;
    margin: 0 auto;
}

/* -----------------------------------------------
   CARD OSSERVATORIO INDICE
   ----------------------------------------------- */
.osservatorio-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: .75rem;
    padding: 1.5rem;
    transition: box-shadow .25s, transform .2s, border-color .2s;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}
.osservatorio-card:hover {
    box-shadow: 0 12px 32px rgba(0,0,0,.10);
    transform: translateY(-3px);
    border-color: var(--bs-primary);
}
.osservatorio-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 0;
    background: linear-gradient(0deg, rgba(0,89,179,.05), transparent);
    transition: height .3s;
    pointer-events: none;
}
.osservatorio-card:hover::after {
    height: 50%;
}
.osservatorio-card .card-icon {
    width: 48px;
    height: 48px;
    border-radius: .6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.osservatorio-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a2b3c;
    margin-bottom: .35rem;
}
.osservatorio-card p {
    color: #6c757d;
    font-size: .9rem;
    line-height: 1.5;
    margin-bottom: 0;
    flex-grow: 1;
}
.osservatorio-card .card-meta {
    margin-top: .75rem;
    font-size: .75rem;
    color: #8a9bb0;
    font-weight: 500;
}
/* Link secondario alla dashboard SIL dettagliata (_MDL):
   deve restare cliccabile sopra lo stretched-link che copre l'intera card. */
.osservatorio-card .mdl-link {
    position: relative;
    z-index: 2;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.osservatorio-card .mdl-link:hover {
    text-decoration: underline;
}

/* -----------------------------------------------
   TABS NAV OSSERVATORIO
   ----------------------------------------------- */
.osservatorio-tabs-wrapper {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.osservatorio-tabs {
    display: flex;
    gap: .25rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding: .5rem 0;
}
.osservatorio-tabs::-webkit-scrollbar {
    display: none;
}

.osservatorio-tab {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border-radius: .45rem;
    font-size: .88rem;
    font-weight: 600;
    color: #5c6f82;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s, box-shadow .15s;
    border: 1px solid transparent;
}
.osservatorio-tab:hover {
    background: #f0f4f8;
    color: #003366;
}
.osservatorio-tab.active {
    background: #0059b3;
    color: #fff;
    border-color: #0059b3;
    box-shadow: 0 2px 8px rgba(0,89,179,.25);
}
.osservatorio-tab.active:hover {
    background: #004a99;
    color: #fff;
}

/* -----------------------------------------------
   RESPONSIVE
   ----------------------------------------------- */
@media (max-width: 767px) {
    .silstat-layout {
        flex-direction: column;
    }
    .silstat-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        height: auto;
        position: relative;
        padding: 1rem;
    }
    .silstat-main {
        padding: 1rem;
    }
    .kpi-value {
        font-size: 1.6rem;
    }
    .osservatorio-tab {
        padding: .45rem .8rem;
        font-size: .85rem;
    }
}
