/* ============================================
   SO.SVI.MA. - Stile applicativo
   Estende Bootstrap Italia con personalizzazioni
   ============================================ */

html {
    scroll-behavior: smooth;
}

/* Hero della home */
.hero-madonie {
    background: linear-gradient(135deg, #0066cc 0%, #003d80 100%);
    color: #fff;
    padding: 5rem 0 6rem;
}

.hero-madonie h1 {
    font-weight: 700;
    letter-spacing: -.5px;
}

.hero-madonie .lead {
    max-width: 720px;
}

/* Hero di pagina interna */
.page-hero {
    background: linear-gradient(135deg, #003d80 0%, #0066cc 100%);
    color: #fff;
    padding: 3.5rem 0 4rem;
}

.page-hero .breadcrumb a {
    color: rgba(255,255,255,.85);
}

.page-hero .breadcrumb .active {
    color: #fff;
}

/* News card */
.news-card {
    border: none;
    border-bottom: 1px solid #e6e9f2;
    border-radius: 0;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
}

.news-card:last-child {
    border-bottom: none;
}

.news-card .news-date {
    font-family: 'Roboto Mono', monospace;
    font-size: .8rem;
    color: #5c6f82;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.news-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: .4rem 0 .6rem;
    line-height: 1.3;
}

.news-card h3 a {
    color: #17324d;
    text-decoration: none;
}

.news-card h3 a:hover {
    color: #0066cc;
    text-decoration: underline;
}

/* Layout admin */
.admin-sidebar .nav-link {
    border-radius: 4px;
    margin-bottom: .25rem;
}

.admin-sidebar .nav-link.active {
    background-color: rgba(255,255,255,.15);
}

/* ============================================
   Fix focus su h1 dopo navigazione (FocusOnNavigate)
   --------------------------------------------
   Gli h1 con tabindex="-1" sono focalizzati programmaticamente da
   FocusOnNavigate di Blazor al cambio pagina. Non sono raggiungibili
   col Tab dall'utente (tabindex=-1 lo impedisce), quindi rimuovere
   l'outline è sicuro: nessun utente da tastiera ci capita "navigando".
   Gli screen reader leggono comunque l'h1 normalmente.
   ============================================ */

h1[tabindex="-1"]:focus,
h1[tabindex="-1"]:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* ============================================
   Sidebar filtri bandi
   --------------------------------------------
   Disabilitiamo il pattern "floating label" di Bootstrap Italia
   (che richiede JS e in static SSR non funziona). Le label sono
   tradizionali, posizionate sopra l'input. La <select> usa lo
   stile nativo del browser per evitare il bug del wrapper BI.
   ============================================ */

.filtri-bandi h2 {
    margin-bottom: 1.25rem;
}

.filtri-bandi .form-label {
    display: block;
    position: static !important; /* annulla position: absolute di BI */
    transform: none !important; /* annulla translate Y di BI */
    font-size: .9rem;
    font-weight: 600;
    color: #17324d;
    margin-bottom: .35rem;
    pointer-events: auto; /* la label deve essere selezionabile */
    opacity: 1 !important;
}

.filtri-bandi .form-control,
.filtri-bandi .form-select {
    padding-top: .5rem;
    padding-bottom: .5rem;
    height: auto;
}

    /* Stato focus pulito */
    .filtri-bandi .form-control:focus,
    .filtri-bandi .form-select:focus {
        border-color: #0066cc;
        box-shadow: 0 0 0 .2rem rgba(0,102,204,.15);
    }

/* Fix doppia freccia nelle select decorate Bootstrap Italia */
.select-wrapper select.form-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none; /* rimuove anche la freccia eventuale di Bootstrap base */
}

/* ============================================
   Indice della pagina con barra verticale stile Design Italia
   --------------------------------------------
   Una linea grigia verticale a sinistra dei link, con un segmento
   colorato (primary) che si sposta a marcare la sezione attiva.
   ============================================ */

.indice-pagina {
    position: sticky;
    top: 1rem; /* la barra resta visibile mentre si scrolla */
    padding-left: 1rem;
}

    .indice-pagina .indice-titolo {
        font-size: .75rem;
        font-weight: 700;
        letter-spacing: .8px;
        color: #0066cc;
        margin-bottom: 1rem;
        text-transform: uppercase;
    }

    .indice-pagina .indice-list {
        list-style: none;
        padding: 0;
        margin: 0;
        position: relative;
        /* La linea grigia di sfondo, a tutta altezza della lista */
        border-left: 2px solid #e6e9f2;
    }

        .indice-pagina .indice-list li {
            padding: 0;
            margin: 0;
        }

        .indice-pagina .indice-list a {
            display: block;
            position: relative;
            padding: .65rem 0 .65rem 1.25rem;
            color: #5c6f82;
            text-decoration: none;
            font-size: .95rem;
            line-height: 1.3;
            transition: color .2s ease;
            /* Per allineare il segmento attivo: l'elemento ha un border-left
       trasparente che diventa primary quando attivo */
            margin-left: -2px; /* sovrappone i 2px della border-left del ul */
            border-left: 2px solid transparent;
        }

            .indice-pagina .indice-list a:hover {
                color: #0066cc;
            }

            /* Sezione attiva: testo blu in grassetto + segmento di barra colorato */
            .indice-pagina .indice-list a.active {
                color: #0066cc;
                font-weight: 600;
                border-left-color: #0066cc;
            }

/* Su mobile/tablet: indice in alto, niente sticky */
@media (max-width: 991.98px) {
    .indice-pagina {
        position: static;
        margin-bottom: 1.5rem;
    }
}

/* ============================================
   Dropdown "Condividi" / "Vedi azioni" stile Design Italia
   Basato su <details> nativo, niente JS.
   ============================================ */
.dropdown-azioni {
    position: relative;
    display: inline-block;
}
.dropdown-azioni > summary {
    cursor: pointer;
    color: #0066cc;
    list-style: none;          /* rimuove il triangolino di default */
    white-space: nowrap;
    user-select: none;
}
.dropdown-azioni > summary::-webkit-details-marker { display: none; } /* Chrome/Safari */
.dropdown-azioni > summary:hover { text-decoration: none; }

.dropdown-azioni-menu {
    position: absolute;
    z-index: 20;
    top: 100%;
    left: 0;
    margin-top: .5rem;
    min-width: 210px;
    background: #fff;
    border: 1px solid #e6e9f2;
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(23,50,77,.15);
    padding: .4rem 0;
    text-align: left;
}
.dropdown-azioni-menu ul { margin: 0; padding: 0; list-style: none; }
.dropdown-azioni-menu a {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem 1.1rem;
    color: #17324d;
    text-decoration: none;
    white-space: nowrap;
}
.dropdown-azioni-menu a:hover {
    background: #f5f6fa;
    color: #0066cc;
}
.dropdown-azioni-menu a .icon { flex-shrink: 0; }

    /* Becco (freccia verso l'alto) che collega il menu al bottone */
    .dropdown-azioni-menu::before,
    .dropdown-azioni-menu::after {
        content: "";
        position: absolute;
        width: 0;
        height: 0;
        border: 9px solid transparent;
    }
    /* Triangolo del bordo (dietro) */
    .dropdown-azioni-menu::before {
        left: 18px;
        bottom: 100%;
        border-bottom-color: #e6e9f2;
    }
    /* Triangolo bianco (davanti, copre l'interno del bordo) */
    .dropdown-azioni-menu::after {
        left: 19px;
        bottom: calc(100% - 1px);
        border-width: 8px;
        border-bottom-color: #fff;
    }

/* ============================================
   AGGIUNGI a wwwroot/css/app.css
   Backdrop per i modali di conferma eliminazione (area admin)
   ============================================ */
.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(23, 50, 77, .5);
    z-index: 1050;
}


.at-card {
    border: 1px solid #e6e9f2;
    transition: all .2s;
}

    .at-card:hover {
        border-color: #0066cc;
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0,102,204,.08);
    }

.at-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 8px;
    background: #e8f1fb;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Fix label sovrapposte negli editor admin
   --------------------------------------------
   Disattiva il floating-label di Bootstrap Italia (JS-driven, non
   affidabile in questi form): le label tornano statiche sopra il campo.
   Mirato all'area admin per non toccare i form pubblici.
   ============================================ */
.admin-form .form-group {
    margin-bottom: 1.25rem;
}

    .admin-form .form-group label {
        display: block !important;
        position: static !important;
        transform: none !important;
        transition: none !important;
        font-size: .9rem;
        font-weight: 600;
        color: #17324d;
        margin-bottom: .35rem;
        opacity: 1 !important;
        pointer-events: auto;
    }

.admin-form .form-control,
.admin-form .form-select {
    height: auto;
    padding-top: .5rem;
    padding-bottom: .5rem;
}

/* La label "In evidenza" del checkbox resta inline accanto alla casella */
.admin-form .form-check label {
    display: inline-block !important;
    font-weight: 400;
    margin-bottom: 0;
    margin-left: .4rem;
}

/*
Amministrazione Trasparente
*/

.at-doc-item {
    border: 1px solid #e6e9f2;
    transition: all .15s;
    display: block;
}

    .at-doc-item:hover {
        border-color: #0066cc;
        box-shadow: 0 4px 14px rgba(0,102,204,.08);
    }

    .at-doc-item .icon {
        flex-shrink: 0;
    }

/*
societa
*/
.societa-card, .servizio-card {
    border: 1px solid #e6e9f2;
    transition: all .15s;
}

    .societa-card:hover, .servizio-card:hover {
        border-color: #0066cc;
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0,102,204,.08);
    }

.societa-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: #e8f1fb;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   AGGIUNGI a wwwroot/css/app.css
   Stili pagina "I Soci" (compagine sociale)
   ============================================================ */

/* Titoli di sezione con barra blu a sinistra */
.soci-h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #17324d;
    margin: 0 0 .25rem;
    padding-left: 14px;
    border-left: 5px solid #0066cc;
    line-height: 1.1;
}

/* Stat card */
.soci-stat {
    background: #fff;
    border: 1px solid #e3e4e6;
    border-radius: 4px;
    padding: 1.25rem;
    box-shadow: 0 2px 0 rgba(23,50,77,.04);
}

.soci-stat-num {
    font-size: 1.7rem;
    font-weight: 700;
    color: #0066cc;
    line-height: 1.05;
}

.soci-stat-lab {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #5b6f82;
    margin-top: .5rem;
}

/* Categorie A / B */
.soci-cat {
    background: #fff;
    border: 1px solid #e3e4e6;
    border-radius: 4px;
    padding: 1.5rem;
}

.soci-chip {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #0066cc;
    background: #E6F0FA;
    border-radius: 99px;
    padding: .25rem .75rem;
}

.soci-cat.priv .soci-chip {
    color: #fff;
    background: #5c6f82;
}

.soci-cat-title {
    margin: .85rem 0 .75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #17324d;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

    .soci-cat-title .pct {
        font-size: 1.9rem;
        color: #0066cc;
    }

.soci-cat.priv .soci-cat-title .pct {
    color: #5c6f82;
}

.soci-progress {
    height: 10px;
    background: #e9ecef;
    border-radius: 99px;
    overflow: hidden;
}

    .soci-progress > span {
        display: block;
        height: 100%;
        background: #0066cc;
        border-radius: 99px;
    }

.soci-cat.priv .soci-progress > span {
    background: #5c6f82;
}

/* Griglia Comuni */
.comuni-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 18px;
}

.comune-card {
    background: #fff;
    border: 1px solid #e3e4e6;
    border-radius: 4px;
    padding: 18px 14px 14px;
    text-align: center;
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}

    .comune-card:hover {
        box-shadow: 0 8px 22px -12px rgba(23,50,77,.35);
        border-color: #bcd4ee;
        transform: translateY(-3px);
    }

.comune-stemma {
    height: 116px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .comune-stemma img {
        max-height: 116px;
        max-width: 100%;
        width: auto;
        object-fit: contain;
    }

.comune-stemma-ph {
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.comune-name {
    margin: .75rem 0 0;
    font-size: .95rem;
    font-weight: 700;
    color: #17324d;
    line-height: 1.3;
}

    .comune-name span {
        font-weight: 400;
        font-size: .78rem;
        color: #5b6f82;
        text-transform: uppercase;
        letter-spacing: .04em;
    }

@media (max-width: 560px) {
    .comuni-grid {
        grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
        gap: 12px;
    }

    .comune-stemma {
        height: 92px;
    }

        .comune-stemma img {
            max-height: 92px;
        }
}

/* ============================================================
   AGGIUNGI a wwwroot/css/app.css
   Pagina Amministratori — card Amministratore Unico in evidenza
   (richiede .soci-h2 e .soci-chip già presenti da app-soci.css)
   ============================================================ */

.amm-unico {
    display: flex;
    gap: 1.75rem;
    align-items: center;
    flex-wrap: wrap;
    background: linear-gradient(180deg, #f4f9ff 0%, #ffffff 100%);
    border: 1px solid #cfe2f5;
    border-left: 6px solid #0066cc;
    border-radius: 8px;
    padding: 1.75rem 2rem;
}

.amm-unico-foto {
    flex: 0 0 auto;
}

    .amm-unico-foto img {
        width: 170px;
        height: 210px;
        object-fit: cover;
        border-radius: 8px;
        border: 3px solid #fff;
        box-shadow: 0 6px 22px -8px rgba(23,50,77,.45);
    }

.amm-unico-info {
    flex: 1 1 280px;
    min-width: 0;
}

.amm-unico-nome {
    font-size: 2rem;
    font-weight: 700;
    color: #17324d;
    margin: .5rem 0 .35rem;
    line-height: 1.1;
}

.amm-tabella thead th {
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #5b6f82;
    border-bottom: 2px solid #0066cc;
}

@media (max-width: 560px) {
    .amm-unico {
        padding: 1.25rem;
        gap: 1.25rem;
    }

    .amm-unico-foto img {
        width: 130px;
        height: 162px;
    }

    .amm-unico-nome {
        font-size: 1.5rem;
    }
}

/* ============================================================
   AGGIUNGI a wwwroot/css/app.css
   Organigramma (pagina /chi-siamo/organigramma)
   ============================================================ */

/* Vertice */
.org-top-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.org-node {
    background: #fff;
    border: 1px solid #d4d8dd;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    box-shadow: 0 2px 6px rgba(23,50,77,.06);
}

    .org-node .org-role {
        font-size: .72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: #5b6f82;
    }

    .org-node .org-title {
        font-size: 1.05rem;
        font-weight: 700;
        color: #17324d;
    }

.org-assemblea {
    background: #17324d;
    border-color: #17324d;
    min-width: 340px;
}

    .org-assemblea .org-role {
        color: #9fc0e0;
    }

    .org-assemblea .org-title {
        color: #fff;
        font-size: 1.3rem;
    }

/* Connettore verticale */
.org-connector {
    width: 2px;
    height: 28px;
    background: #c6ccd3;
}

/* Riga organi */
.org-governance {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.org-evidenza {
    border: 2px solid #0066cc;
    background: linear-gradient(180deg,#f4f9ff,#fff);
    box-shadow: 0 6px 20px -8px rgba(0,102,204,.4);
}

    .org-evidenza .org-role {
        color: #0066cc;
    }

/* Intestazione aree */
.org-areas-head {
    border-left: 5px solid #0066cc;
    padding-left: 14px;
    margin-bottom: 1.25rem;
}

.org-areas-label {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: #17324d;
}

/* Griglia aree operative */
.org-areas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
}

.org-area {
    background: #fff;
    border: 1px solid #e3e4e6;
    border-top: 5px solid var(--c, #0066cc);
    border-radius: 6px;
    overflow: hidden;
}

    .org-area > header {
        background: var(--c, #0066cc);
        color: #17324d;
        font-weight: 700;
        padding: .85rem 1rem;
        line-height: 1.2;
    }

.org-resp {
    margin: .9rem 1rem 0;
    font-size: .9rem;
    color: #17324d;
}

.org-staff {
    list-style: none;
    margin: .75rem 0 0;
    padding: .25rem 1rem 1.1rem;
}

    .org-staff li {
        font-size: .9rem;
        color: #44525f;
        padding: .35rem 0 .35rem 1.25rem;
        position: relative;
    }

        .org-staff li::before {
            content: "";
            position: absolute;
            left: 0;
            top: .85rem;
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: var(--c, #0066cc);
        }

@media (max-width: 768px) {
    .org-governance {
        grid-template-columns: 1fr;
        gap: .9rem;
    }

    .org-assemblea {
        min-width: 0;
        width: 100%;
    }
}

/*
cookie banner
*/

.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1080;
    background: #17324d;
    color: #fff;
    padding: 1rem 0;
    box-shadow: 0 -4px 16px rgba(0,0,0,.2);
}
.cookie-banner-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: space-between;
}
.cookie-banner-text { font-size: .9rem; flex: 1 1 320px; }
.cookie-banner-text a { color: #fff; text-decoration: underline; }
.cookie-banner .btn { flex-shrink: 0; }

.notfound-code {
    font-size: clamp(5rem, 18vw, 9rem);
    font-weight: 800;
    line-height: 1;
    color: #0066cc;
    opacity: .15;
    margin: 0;
    letter-spacing: -.03em;
}

.cerca-item {
    border: 1px solid #e6e9f2;
    transition: all .15s;
    display: block;
}

    .cerca-item:hover {
        border-color: #0066cc;
        box-shadow: 0 4px 14px rgba(0,102,204,.08);
    }

/* Form pubblici: label statiche sopra il campo (no floating BI rotto in SSR) */
.form-statica .form-group {
    margin-bottom: 1.25rem;
}

.form-statica > .form-group > label,
.form-statica label[for] {
    display: block !important;
    position: static !important;
    transform: none !important;
    transition: none !important;
    font-weight: 600;
    font-size: .9rem;
    color: #17324d;
    margin-bottom: .35rem;
    opacity: 1 !important;
}

.form-statica .form-check label {
    display: inline !important;
    font-weight: 400;
    margin-left: .4rem;
}

.form-statica .form-control {
    height: auto;
}

/* Honeypot: invisibile agli umani, presente per i bot */
.hp-field {
    position: absolute !important;
    left: -5000px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}