/* ==========================================================================
   PRG SELLANO - Portale urbanistico
   Bootstrap 4 e jQuery serviti da /libs, nessuna dipendenza esterna:
   il portale deve funzionare anche senza uscire dalla rete comunale.
   Ripreso dal modello in modellosito, con i font di sistema al posto di
   quelli di Google.
   ========================================================================== */

:root {
    --primary-color: #0d47a1;
    --primary-dark: #0a3680;
    --primary-light: #1e88e5;
    --accent-color: #2e7d32;
    --accent-gold: #f59e0b;
    --bg-gradient-start: #0b1d3a;
    --bg-gradient-end: #173868;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 4px 6px -1px rgba(0,0,0,.05), 0 2px 4px -1px rgba(0,0,0,.03);
    --shadow-md: 0 10px 25px -5px rgba(13,71,161,.12), 0 8px 10px -6px rgba(0,0,0,.04);
    --shadow-hover: 0 20px 30px -10px rgba(13,71,161,.22), 0 12px 15px -8px rgba(0,0,0,.08);
    --font-titoli: 'Segoe UI Semibold', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    --font-testo: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    font-family: var(--font-testo);
    color: var(--text-main);
    background-color: #f8fafc;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font-titoli); font-weight: 600; }

/* il contenuto raggiunto da un'ancora non deve finire sotto la barra fissa */
:target { scroll-margin-top: 90px; }

/* ── Barra istituzionale ─────────────────────────────────────────────────── */
.top-bar { background-color: #07152b; color: #94a3b8; font-size: .85rem; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.top-bar a { color: #cbd5e1; transition: color .2s; }
.top-bar a:hover { color: #fff; text-decoration: none; }

/* ── Barra di navigazione ────────────────────────────────────────────────── */
.navbar-sellano { background: #fff; box-shadow: 0 2px 15px rgba(0,0,0,.06); padding: 12px 0; }
.navbar-brand-wrapper { display: flex; align-items: center; }
.navbar-brand-wrapper:hover { text-decoration: none; }
/* lo stemma ha fondo chiaro: sul riquadro scuro del modello sparirebbe,
   quindi qui il riquadro resta bianco con un bordo tenue */
.brand-coat { width: 46px; height: 48px; display: flex; align-items: center; justify-content: center; margin-right: 12px; flex-shrink: 0; }
.brand-coat img { max-width: 100%; max-height: 46px; width: auto; height: auto; }
.brand-coat > i { width: 44px; height: 48px; background: linear-gradient(135deg, #1b4332, #0d47a1); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.4rem; box-shadow: 0 4px 10px rgba(13,71,161,.25); }
.brand-text-main { font-family: var(--font-titoli); font-size: 1.25rem; font-weight: 700; color: #0f172a; line-height: 1.1; }
.brand-text-sub { font-size: .78rem; color: #0d47a1; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; }
.nav-link-custom { font-weight: 500; color: #334155 !important; padding: 8px 16px !important; border-radius: 6px; transition: all .2s ease; }
.nav-link-custom:hover { color: #0d47a1 !important; background-color: #f1f5f9; }
.nav-link-custom.active { color: #0d47a1 !important; background-color: #eff6ff; font-weight: 600; }

/* ── Testata ─────────────────────────────────────────────────────────────── */
.hero-section { background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%); color: #fff; padding: 60px 0 80px; position: relative; overflow: hidden; }
.hero-section::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(circle at 80% 20%, rgba(30,136,229,.15) 0%, transparent 50%),
                radial-gradient(circle at 20% 80%, rgba(46,125,50,.15) 0%, transparent 50%);
}
.hero-section .container { position: relative; z-index: 1; }
.hero-title { font-size: 2.75rem; font-weight: 700; line-height: 1.15; margin-bottom: 16px; }
.hero-subtitle { font-size: 1.15rem; color: #b6c2d4; max-width: 720px; margin-bottom: 30px; font-weight: 300; }
.hero-riquadro { background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.2); border-radius: 12px; }

/* ── Ricerca ─────────────────────────────────────────────────────────────── */
.search-box-container { background: rgba(255,255,255,.12); padding: 8px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); max-width: 680px; box-shadow: 0 15px 35px rgba(0,0,0,.2); position: relative; }
.search-input-group { display: flex; align-items: center; background: #fff; border-radius: 8px; padding: 4px 6px; }
.search-input-group > i { color: #94a3b8; font-size: 1.1rem; margin-left: 12px; }
.search-input-group .form-control { border: none; box-shadow: none; font-size: 1rem; padding: 10px 14px; }
.search-input-group .form-control:focus { outline: none; box-shadow: none; }
.btn-search { background: var(--primary-color); color: #fff; border-radius: 6px; padding: 10px 24px; font-weight: 600; border: none; transition: all .2s ease; white-space: nowrap; }
.btn-search:hover { background: var(--primary-dark); color: #fff; }

/* esiti della ricerca, sovrapposti al contenuto sottostante */
.search-esiti { display: none; position: absolute; left: 8px; right: 8px; top: calc(100% - 2px); z-index: 1000; background: #fff; border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 18px 40px rgba(0,0,0,.28); max-height: 60vh; overflow-y: auto; text-align: left; }
.search-esiti.aperto { display: block; }
.search-esito { display: block; padding: 10px 14px; border-bottom: 1px solid #f1f5f9; color: var(--text-main); }
.search-esito:last-child { border-bottom: none; }
.search-esito:hover, .search-esito:focus { background: #f8fafc; text-decoration: none; color: var(--primary-color); }
.search-esito-titolo { font-weight: 600; font-size: .95rem; }
.search-esito-dettaglio { font-size: .82rem; color: var(--text-muted); }
.search-vuoto { padding: 14px; color: var(--text-muted); font-size: .9rem; }

/* ── Riquadri di sintesi ─────────────────────────────────────────────────── */
.stats-bar { margin-top: -35px; position: relative; z-index: 10; margin-bottom: 50px; }
.stats-card { background: #fff; border-radius: 12px; padding: 20px 24px; box-shadow: var(--shadow-md); border: 1px solid rgba(226,232,240,.8); display: flex; align-items: center; height: 100%; }
.stats-icon { width: 52px; height: 52px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-right: 16px; flex-shrink: 0; }
.icon-blue { background: #eff6ff; color: #1d4ed8; }
.icon-green { background: #f0fdf4; color: #15803d; }
.icon-amber { background: #fffbeb; color: #b45309; }
.icon-purple { background: #faf5ff; color: #7e22ce; }
.stats-num { font-family: var(--font-titoli); font-size: 1.4rem; font-weight: 700; color: #0f172a; line-height: 1; }
.stats-label { font-size: .85rem; color: #64748b; margin-top: 4px; font-weight: 500; }

/* ── Filtri ──────────────────────────────────────────────────────────────── */
.filter-pills-container { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 35px; justify-content: center; }
.filter-btn { background: #fff; border: 1px solid #cbd5e1; color: #475569; padding: 8px 20px; border-radius: 30px; font-size: .9rem; font-weight: 500; transition: all .2s ease; cursor: pointer; }
.filter-btn:hover { border-color: var(--primary-color); color: var(--primary-color); background: #f8fafc; }
.filter-btn.active { background: var(--primary-color); color: #fff; border-color: var(--primary-color); box-shadow: 0 4px 12px rgba(13,71,161,.25); }

/* ── Schede delle sezioni ────────────────────────────────────────────────── */
.prg-card { background: #fff; border-radius: 16px; border: 1px solid #e2e8f0; overflow: hidden; box-shadow: var(--shadow-sm); transition: all .3s cubic-bezier(.16,1,.3,1); height: 100%; display: flex; flex-direction: column; }
.prg-card:hover { transform: translateY(-8px); box-shadow: var(--shadow-hover); border-color: #cbd5e1; }
.card-img-wrapper { position: relative; height: 200px; overflow: hidden; background-color: #0f172a; }
.card-img-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.prg-card:hover .card-img-wrapper img { transform: scale(1.06); }
.card-img-vuota { display: flex; align-items: center; justify-content: center; height: 100%; color: #475569; font-size: 3rem; }
/* L'immagine apre la mappa. Il collegamento deve riempire il riquadro,
   altrimenti l'altezza al 100% dell'immagine si misurerebbe su di lui e
   non sui 200px del contenitore. Al passaggio del mouse compare il segno
   della mappa: senza, la foto sembra decorativa e nessuno ci prova. */
.card-img-link { display: block; height: 100%; position: relative; }
.card-img-link::after {
    content: "\f5a0"; font-family: "Font Awesome 5 Free"; font-weight: 900;
    position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem; color: #fff; background: rgba(15,23,42,.45);
    opacity: 0; transition: opacity .25s ease;
}
.card-img-link:hover::after { opacity: 1; }
.card-code-badge { position: absolute; top: 14px; left: 14px; background: rgba(15,23,42,.85); color: #fff; font-family: var(--font-titoli); font-weight: 700; font-size: .85rem; padding: 4px 12px; border-radius: 6px; border: 1px solid rgba(255,255,255,.2); }
.card-type-tag { position: absolute; bottom: 14px; right: 14px; background: rgba(13,71,161,.9); color: #fff; font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; text-transform: uppercase; }
.card-body-custom { padding: 24px; display: flex; flex-direction: column; flex-grow: 1; }
.card-title-custom { font-size: 1.2rem; font-weight: 700; color: #0f172a; margin-bottom: 10px; line-height: 1.3; }
.card-desc-custom { font-size: .9rem; color: #64748b; margin-bottom: 20px; line-height: 1.5; flex-grow: 1; }
.card-meta-list { font-size: .8rem; color: #94a3b8; border-top: 1px solid #f1f5f9; padding-top: 14px; margin-bottom: 20px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.card-actions { display: flex; gap: 10px; }
.btn-card-primary { flex: 1; background: var(--primary-color); color: #fff !important; font-weight: 600; font-size: .88rem; padding: 9px 14px; border-radius: 8px; text-align: center; transition: all .2s ease; border: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none !important; }
.btn-card-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 10px rgba(13,71,161,.3); }
.btn-card-secondary { background: #f1f5f9; color: #334155 !important; font-weight: 600; font-size: .88rem; padding: 9px 12px; border-radius: 8px; border: 1px solid #cbd5e1; transition: all .2s ease; display: inline-flex; align-items: center; justify-content: center; text-decoration: none !important; }
.btn-card-secondary:hover { background: #e2e8f0; color: #0f172a !important; }

/* ── Sezione informativa ─────────────────────────────────────────────────── */
.info-section { background: #fff; padding: 70px 0; border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.feature-box { padding: 24px; border-radius: 12px; background: #f8fafc; border: 1px solid #f1f5f9; height: 100%; }
.feature-icon { font-size: 2rem; color: var(--primary-color); margin-bottom: 16px; }

/* ── Riquadro del programma per Windows ──────────────────────────────────── */
.standalone-box { background: linear-gradient(135deg, #0b1d3a, #173868); color: #fff; border-radius: 14px; padding: 28px 32px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.standalone-box .standalone-icona { font-size: 2.6rem; color: var(--accent-gold); flex-shrink: 0; }
.standalone-box h4 { color: #fff; margin-bottom: 6px; }
.standalone-box p { color: #b6c2d4; margin-bottom: 0; font-size: .92rem; }

/* ── Pagina di sezione ───────────────────────────────────────────────────── */
.sezione-testa { background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end)); color: #fff; padding: 34px 0; }
.sezione-testa .badge-codice { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); color: #fff; font-family: var(--font-titoli); font-weight: 700; letter-spacing: .5px; padding: 5px 12px; border-radius: 6px; }
.scheda-dati { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 22px 24px; }
.scheda-dati dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; font-weight: 700; margin-bottom: 2px; }
.scheda-dati dd { margin-bottom: 14px; color: #0f172a; font-size: .95rem; }
.scheda-dati dd:last-child { margin-bottom: 0; }
.gruppo-livelli { border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.gruppo-livelli > summary { padding: 12px 16px; background: #f8fafc; cursor: pointer; font-weight: 600; font-size: .95rem; list-style: none; display: flex; align-items: center; gap: 9px; }
.gruppo-livelli > summary::-webkit-details-marker { display: none; }
.gruppo-livelli > summary::before { content: '\f078'; font-family: 'Font Awesome 5 Free'; font-weight: 900; font-size: .72rem; color: #94a3b8; transition: transform .2s; }
.gruppo-livelli[open] > summary::before { transform: rotate(-180deg); }
.gruppo-livelli .conta { margin-left: auto; font-size: .8rem; color: #94a3b8; font-weight: 500; }
.elenco-livelli { list-style: none; margin: 0; padding: 8px 16px 14px; columns: 2; column-gap: 26px; }
.elenco-livelli li { font-size: .88rem; color: #475569; padding: 3px 0; break-inside: avoid; }
@media (max-width: 767px) { .elenco-livelli { columns: 1; } }

/* ── Guida ───────────────────────────────────────────────────────────────── */
.guida-testo { font-size: 1rem; line-height: 1.7; color: #374151; }
.guida-testo h2 { margin-top: 1.6rem; scroll-margin-top: 90px; }
.guida-testo h2:first-child { margin-top: 0; }
.guida-testo ul { margin-bottom: 1rem; }
.guida-testo li { margin-bottom: .45rem; }
.guida-testo code { background: #f1f5f9; color: #0f172a; padding: .15rem .4rem; border-radius: 4px; font-size: .92em; }
.guida-indice li { margin-bottom: .5rem; }
.guida-indice a { color: var(--text-main); font-size: .92rem; }
.guida-indice a:hover { color: var(--primary-color); }
/* l'indice resta a portata mentre si scorre il testo */
@media (min-width: 992px) { .guida-testo + .col-lg-4 .scheda-dati:first-child { position: sticky; top: 90px; } }

/* ── Piè di pagina ───────────────────────────────────────────────────────── */
.footer-sellano { background: #07152b; color: #94a3b8; padding: 60px 0 30px; font-size: .9rem; }
.footer-sellano h5 { color: #fff; font-size: 1.1rem; margin-bottom: 20px; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 10px; }
.footer-links a { color: #94a3b8; transition: color .2s; }
.footer-links a:hover { color: #fff; text-decoration: none; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); margin-top: 40px; padding-top: 25px; font-size: .85rem; }

@media (max-width: 991px) {
    .hero-title { font-size: 2.1rem; }
    .hero-section { padding: 44px 0 64px; }
}

/* ── Atti dell'ultima variante, in testa alla home ─────────────────────────
   Stessi riquadri di prima, .stats-card intatto: cambia solo che adesso sono
   collegamenti. Nessuna sottolineatura in nessuno stato, e nessun colore da
   link: il riquadro e' gia' evidentemente cliccabile per come e' fatto. */
a.stats-card, a.stats-card:hover, a.stats-card:focus, a.stats-card:active, a.stats-card:visited,
a.stats-card * { text-decoration: none !important; }
a.stats-card, a.stats-card:hover, a.stats-card:focus, a.stats-card:active, a.stats-card:visited { color: inherit; }
a.stats-card:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }

/* il titolo di un atto e' una frase, non un numero: stessa impostazione di
   .stats-num, dimensione adatta a una riga di testo */
.doc-titolo {
    font-family: var(--font-titoli); font-weight: 700; color: #0f172a;
    font-size: 1.02rem; line-height: 1.25; overflow-wrap: break-word;
}
.doc-card-assente .doc-titolo { color: #64748b; }
.doc-card-assente { border-style: dashed; }
.doc-card-assente .stats-icon { opacity: .45; }

@media (max-width: 575.98px) {
    /* a tutta larghezza: a meta' schermo i titoli lunghi si spezzavano male */
    .stats-bar { margin-top: -24px; margin-bottom: 34px; }
    .stats-card { padding: 15px 17px; }
    .stats-card .stats-icon { width: 44px; height: 44px; font-size: 1.15rem; margin-right: 13px; }
    .doc-titolo { font-size: .97rem; }
}

/* suggerimenti distinti da un valore scritto davvero */
::-webkit-input-placeholder { color: #b3b9c4; font-style: italic; opacity: 1; }
::-moz-placeholder { color: #b3b9c4; font-style: italic; opacity: 1; }
:-ms-input-placeholder { color: #b3b9c4; font-style: italic; }
::placeholder { color: #b3b9c4; font-style: italic; opacity: 1; }
