/*
 * PRIMO CITTADINO - STYLE.CSS
 * Stili globali del sito
 * ========================================
 */

/* =================================================================
   VARIABILI CSS
   ================================================================= */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #004d99;
    --accent-color: #ee6c4d;
    --light-bg: #f8f9fa;
    --text-dark: #293241;
    --header-blue: #1639A2;
    --male-color: #4a90d9;
    --female-color: #e84393;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --radius-box: 10px;
}

/* =================================================================
   BASE
   ================================================================= */
html {
    background-color: var(--light-bg);
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    background: var(--light-bg);
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* List markers color for legal pages */
main > .container > ul li::marker,
main > .container > ol li::marker {
    color: #0d6efd;
}

/* Links color for legal/info pages */
main.py-5 > .container a {
    color: #0d6efd;
}

main.py-5 > .container a:hover {
    color: #1a429e;
}

/* =================================================================
   HEADER / NAVBAR
   ================================================================= */
.site-header {
    background: var(--header-blue);
    padding: 1.25rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-logo {
    height: 48px;
    width: auto;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-nav a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    transition: color 0.2s ease;
}

.header-nav a:hover {
    color: #ffffff;
    text-decoration: none;
}

.header-nav a.active {
    color: #ffffff;
    position: relative;
}

.header-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -2.12rem;
    left: 0;
    right: 0;
    height: 3px;
    background: #ffffff;
}

/* Hamburger Button */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    flex-direction: column;
    background: var(--header-blue);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-menu.open {
    max-height: 400px;
    padding: 1rem 0;
}

.mobile-menu a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: all 0.2s ease;
}

.mobile-menu a:last-child {
    border-bottom: none;
}

.mobile-menu a:hover,
.mobile-menu a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

@media (max-width: 991.98px) {
    .hamburger-btn {
        display: flex;
    }
    
    .header-nav {
        display: none;
    }
    
    .mobile-menu {
        display: flex;
    }
}

/* =================================================================
   PAGE HEADER
   ================================================================= */
.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 3rem 0;
    padding-top: calc(3rem + 120px);
    position: relative;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/img/bg-header.png') left center no-repeat;
    background-size: auto 200%;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.page-header .container {
    position: relative;
    z-index: 1;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #009246 0%, #009246 33.33%, #ffffff 33.33%, #ffffff 66.66%, #ce2b37 66.66%, #ce2b37 100%);
}

.page-header.green {
    background: #0d6efd;
}

/* Regioni page header color */
.page-header.regioni {
    background: #0d6efd;
}

.page-header.regioni + main .info-card h5 i {
    color: #0d6efd;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* =================================================================
   BREADCRUMB
   ================================================================= */
.breadcrumb-custom {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-custom a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}

.breadcrumb-custom a:hover {
    color: white;
}

.breadcrumb-custom .separator {
    color: rgba(255,255,255,0.5);
    margin: 0 0.5rem;
}

/* =================================================================
   STAT CARDS
   ================================================================= */
.stat-cards {
    margin-top: -50px;
    position: relative;
    z-index: 10;
}

.stat-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    text-align: center;
    height: 100%;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #293241 !important;
}

.stat-label {
    font-size: 0.85rem;
    color: #6c757d;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3d8bfd, #0d6efd);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.25rem auto;
    font-size: 1.25rem;
    color: white;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background-clip: unset;
}

.stat-icon-img {
    height: 2rem;
    width: auto;
    margin-bottom: 0.5rem;
}

.stat-icon-italy {
    height: 2rem;
    width: 2rem;
    margin: 0 auto 0.5rem auto;
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
    -webkit-mask: url('/img/italy.svg') no-repeat center;
    mask: url('/img/italy.svg') no-repeat center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

/* =================================================================
   CONTENT CARD
   ================================================================= */
.content-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 2.5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    margin-top: -50px;
    position: relative;
    z-index: 10;
}

@media (max-width: 767.98px) {
    .content-card {
        padding: 1rem;
        overflow: hidden;
        max-width: 100vw;
    }
    
    /* Previeni overflow orizzontale su tutto il body */
    body {
        overflow-x: hidden;
    }
    
    main.py-5 {
        overflow-x: hidden;
    }
}

.content-card h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.content-card h2:first-child {
    margin-top: 0;
}

.content-card p,
.content-card li {
    line-height: 1.8;
    color: #4a5568;
}

.content-card ul {
    padding-left: 1.5rem;
}

.content-card ul li {
    margin-bottom: 0.5rem;
}

/* =================================================================
   INFO CARD
   ================================================================= */
.info-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.info-card h5 {
    color: var(--text-dark);
    font-weight: 600;
}

.info-card h5 i {
    color: var(--primary-color);
}

/* =================================================================
   GRID CARDS (Regioni, Province, etc.)
   ================================================================= */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.card-item {
    background: white;
    border-radius: var(--radius-box);
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-dark);
    border-left: 4px solid var(--primary-color);
}

.card-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    color: var(--text-dark);
    text-decoration: none;
}

.card-item-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.75rem;
}

.card-item-subtitle {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.card-item-subtitle i {
    color: var(--accent-color);
}

.card-item-stats {
    display: flex;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.card-item-stat {
    text-align: center;
}

.card-item-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
}

.card-item-stat-label {
    font-size: 0.7rem;
    color: #6c757d;
    text-transform: uppercase;
}

/* =================================================================
   REGIONI GRID
   ================================================================= */
.regioni-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

@media (max-width: 767.98px) {
    .regioni-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
}

.regione-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-dark);
    border-left: 4px solid #0d6efd;
}

.regione-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    color: var(--text-dark);
    text-decoration: none;
}

.regione-nome {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.75rem;
}

.regione-presidente {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.regione-presidente i {
    color: #0d6efd;
}

.regione-stats {
    display: flex;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.regione-stat {
    text-align: center;
}

.regione-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
}

.regione-stat-label {
    font-size: 0.7rem;
    color: #6c757d;
    text-transform: uppercase;
}

/* =================================================================
   PROVINCE GRID
   ================================================================= */
.province-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.regione-header {
    background: #0d6efd;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-box);
    margin: 2rem 0 1rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.regione-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.regione-header a {
    color: white;
    text-decoration: none;
}

.regione-header a:hover {
    text-decoration: underline;
}

.regione-count {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.provincia-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 1.25rem;
    box-shadow: 0 3px 15px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-dark);
    border-left: 4px solid #0d6efd;
}

.provincia-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    color: var(--text-dark);
    text-decoration: none;
}

.provincia-nome {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.provincia-sigla {
    display: inline-block;
    background: #e0e7ff;
    color: #0d6efd;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.provincia-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #6c757d;
}

.provincia-stats i {
    margin-right: 4px;
}

/* Province page header color */
.page-header.province {
    background: #0d6efd;
}

.page-header.province + main .info-card h5 i {
    color: #0d6efd;
}

/* Città Metropolitane page */
.page-header.citta-metro {
    background: #0d6efd;
}

.citta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.citta-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-dark);
    border-left: 4px solid #0d6efd;
}

.citta-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    color: var(--text-dark);
    text-decoration: none;
}

.citta-nome {
    font-size: 1.25rem;
    font-weight: 700;
    color: #293241;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
}

.citta-nome i {
    color: #0d6efd;
    margin-right: 0.5rem;
}

.citta-regione {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.citta-sigla {
    display: inline-block;
    background: #e0e7ff;
    color: #0d6efd;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.citta-stats {
    display: flex;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.citta-stat {
    text-align: center;
}

.citta-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0d6efd;
}

.citta-stat-label {
    font-size: 0.7rem;
    color: #6c757d;
    text-transform: uppercase;
}

.page-header.citta-metro + main .info-card h5 i {
    color: #0d6efd;
}

@media (max-width: 768px) {
    .citta-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Comuni page */
.page-header.comuni {
    background: #0d6efd;
}

.filter-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

.alphabet-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.alphabet-filter a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-box);
    background: var(--light-bg);
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.alphabet-filter a.all {
    width: auto;
    padding: 0 1rem;
}

.alphabet-filter a:hover {
    background: #0d6efd;
    color: white;
}

.alphabet-filter a.active {
    background: #0d6efd;
    color: white;
}

.comuni-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.comune-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 1rem 1.25rem;
    box-shadow: 0 3px 15px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comune-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    color: var(--text-dark);
    text-decoration: none;
}

.comune-info {
    flex: 1;
}

.comune-nome {
    font-weight: 600;
    color: #0d6efd;
    margin-bottom: 0.25rem;
}

.comune-prov {
    font-size: 0.8rem;
    color: #6c757d;
}

.comune-abitanti {
    text-align: right;
    font-size: 0.85rem;
    color: #6c757d;
}

.comune-abitanti strong {
    display: block;
    font-size: 1rem;
    color: #0d6efd;
}

.pagination-wrapper {
    margin-top: 2rem;
}

.pagination .page-link {
    color: #0d6efd;
    border-radius: var(--radius-box);
    margin: 0 2px;
    background: white;
}

.pagination .page-item.active .page-link {
    background: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

.page-header.comuni + main .info-card h5 i {
    color: #0d6efd;
}

@media (max-width: 768px) {
    .comuni-grid {
        grid-template-columns: 1fr;
    }
    
    .alphabet-filter a {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
}

/* Indennità page */
.page-header.indennita {
    background: #0d6efd;
}

.page-header.indennita + main .content-card {
    margin-top: 0;
}

.page-header.indennita + main .content-card + .content-card {
    margin-top: 2rem;
}

.page-header.indennita + main .section-title {
    color: #0d6efd;
    border-bottom-color: #0d6efd;
}

.page-header.indennita + main .section-title i {
    color: #0d6efd;
}

.page-header.indennita + main .card-title {
    color: #293241;
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.page-header.indennita + main .card-title i {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3d8bfd, #0d6efd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.page-header.indennita + main .sidebar-title {
    color: #293241;
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
    padding-bottom: 0;
    border-bottom: none;
}

.page-header.indennita + main .sidebar-title i {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3d8bfd, #0d6efd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.page-header.indennita + main .card-title-sub {
    color: #293241;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header.indennita + main .card-title-sub i {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3d8bfd, #0d6efd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
}

.icon-card {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: var(--radius-box);
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    height: 100%;
}

.icon-card .icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
    color: white;
}

.icon-card.sindaco .icon-wrapper {
    background: linear-gradient(135deg, #3d8bfd, #0d6efd);
}

.icon-card.assessore .icon-wrapper {
    background: linear-gradient(135deg, #3d8bfd, #0d6efd);
}

.icon-card.consigliere .icon-wrapper {
    background: linear-gradient(135deg, #3d8bfd, #0d6efd);
}

.icon-card h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #293241;
    margin-bottom: 0.5rem;
}

.icon-card p {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.info-box {
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border-left: 4px solid #FA6400;
    padding: 1rem 1.5rem;
    border-radius: 0 var(--radius-box) var(--radius-box) 0;
    margin-bottom: 1.5rem;
}

.info-box i {
    color: #FA6400;
    margin-right: 8px;
}

.info-box.blue {
    background: linear-gradient(135deg, #f0f7ff, #e0efff);
    border-left-color: #0d6efd;
}

.info-box.blue i {
    color: #0d6efd;
}

.warning-box {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border-left: 4px solid #ff9800;
    padding: 1rem 1.5rem;
    border-radius: 0 var(--radius-box) var(--radius-box) 0;
    margin-bottom: 1.5rem;
}

.warning-box i {
    color: #ff9800;
    margin-right: 8px;
}

.table-indennita {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-box);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    max-width: 100%;
    table-layout: fixed;
}

@media (max-width: 767.98px) {
    .table-indennita,
    .content-card .table-indennita {
        table-layout: fixed !important;
        width: 100% !important;
    }
    
    .table-indennita th,
    .table-indennita td,
    .content-card .table-indennita th,
    .content-card .table-indennita td {
        padding: 0.5rem 0.3rem !important;
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 0 !important;
    }
    
    /* Prima colonna 60% */
    .table-indennita th:first-child,
    .table-indennita td:first-child {
        width: 60% !important;
    }
    
    /* Seconda colonna 40% */
    .table-indennita th:nth-child(2),
    .table-indennita td:nth-child(2) {
        width: 40% !important;
    }
    
    /* Nascondi icone nelle tabelle su mobile */
    .table-indennita th i,
    .table-indennita td i {
        display: none !important;
    }
    
    /* Nascondi la terza colonna (Note) su mobile solo per tabelle con classe specifica */
    .table-indennita.hide-notes-mobile th:nth-child(3),
    .table-indennita.hide-notes-mobile td:nth-child(3) {
        display: none !important;
    }
    
    /* Tabelle a 3 colonne che mostrano tutte le colonne */
    .table-indennita:not(.hide-notes-mobile) th:first-child,
    .table-indennita:not(.hide-notes-mobile) td:first-child {
        width: 40% !important;
    }
    
    .table-indennita:not(.hide-notes-mobile) th:nth-child(2),
    .table-indennita:not(.hide-notes-mobile) td:nth-child(2) {
        width: 30% !important;
    }
    
    .table-indennita:not(.hide-notes-mobile) th:nth-child(3),
    .table-indennita:not(.hide-notes-mobile) td:nth-child(3) {
        width: 30% !important;
    }
}

.table-indennita thead {
    background: #0d6efd;
    color: white;
}

.table-indennita th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.table-indennita td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #e9ecef;
}

.table-indennita tbody tr:last-child td {
    border-bottom: none;
}

.table-indennita tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.table-indennita tbody tr:hover {
    background: #eff6ff;
}

.table-indennita .importo {
    font-weight: 700;
    color: #0d6efd;
    font-size: 1.1rem;
}

.table-indennita .highlight-row {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2) !important;
}

.table-indennita .highlight-row td {
    font-weight: 600;
}

.percentuale-badge {
    display: inline-block;
    background: #0d6efd;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.sidebar-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0d6efd;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-bg);
}

.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f3f4;
}

.sidebar-list li:last-child {
    border-bottom: none;
}

.sidebar-list a {
    color: var(--text-dark);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-list a:hover {
    color: #0d6efd;
}

.sidebar-list i {
    color: #0d6efd;
    width: 20px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    padding: 0.5rem 0;
}

.toc-list a {
    color: var(--text-dark);
    text-decoration: none;
    display: block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-box);
    transition: all 0.2s ease;
}

.toc-list a:hover {
    background: var(--light-bg);
    color: #0d6efd;
}

@media (max-width: 768px) {
    .table-indennita {
        font-size: 0.85rem;
    }
    
    .table-indennita th,
    .table-indennita td {
        padding: 0.5rem;
    }
}

/* =================================================================
   SCHEDA REGIONE
   ================================================================= */
.page-header.regione-detail {
    background: #0d6efd;
}

.regione-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.regione-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.presidente-card {
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
    color: white;
    border-radius: var(--radius-box);
    padding: 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.presidente-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/img/bg-fascia.png') right center no-repeat;
    background-size: auto 150%;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.presidente-card > * {
    position: relative;
    z-index: 1;
}

.presidente-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.presidente-name {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.presidente-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.presidente-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.presidente-info-item i {
    opacity: 0.8;
}

.vice-card {
    background: linear-gradient(135deg, #6DD400, #AAED63);
    color: white;
    border-radius: var(--radius-box);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.vice-label {
    font-size: 0.8rem;
    opacity: 0.9;
}

.vice-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.amm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.amm-card {
    background: var(--light-bg);
    border-radius: var(--radius-box);
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.amm-card:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.amm-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.amm-role {
    font-size: 0.85rem;
    color: #0d6efd;
    margin-bottom: 0.5rem;
}

.amm-details {
    font-size: 0.8rem;
    color: #6c757d;
}

.amm-gender {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.amm-gender.male {
    background: #32C5FF;
}

.amm-gender.female {
    background: #e84393;
}

.admin-tabs .nav-link {
    color: var(--text-dark);
    border: none;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
}

.admin-tabs .nav-link.active {
    color: #0d6efd;
    background: transparent;
    border-bottom: 3px solid #0d6efd;
}

.admin-tabs .nav-link .badge {
    background: var(--light-bg);
    color: var(--text-dark);
    margin-left: 6px;
}

.admin-tabs .nav-link.active .badge {
    background: #0d6efd;
    color: white;
}

@media (max-width: 768px) {
    .regione-title {
        font-size: 1.75rem;
    }
    
    .presidente-name {
        font-size: 1.5rem;
    }
}

.province-grid {
    display: flex;
    flex-direction: column;
    margin-top: 1rem;
}

.provincia-card {
    background: var(--light-bg);
    border-radius: var(--radius-box);
    padding: 1.25rem;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.3s ease;
    border-left: 4px solid #0d6efd;
    margin-bottom: 1.25rem;
}

.provincia-card:last-child {
    margin-bottom: 0;
}

.provincia-card:hover {
    background: #e9ecef;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    color: var(--text-dark);
    text-decoration: none;
}

.provincia-nome {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.provincia-presidente {
    font-size: 0.85rem;
    color: #0d6efd;
    margin-bottom: 0.5rem;
}

.provincia-stats {
    font-size: 0.8rem;
    color: #6c757d;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header.regione-detail + main .card-title {
    color: #293241;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header.regione-detail + main .card-title i {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3d8bfd, #0d6efd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

/* =================================================================
   SCHEDA COMUNE
   ================================================================= */
.page-header.comune-detail {
    background: #0d6efd;
}

.comune-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.comune-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.badge-capoluogo {
    background: #f59e0b;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-left: 1rem;
}

.badge-commissariato {
    background: #dc3545;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-left: 1rem;
}

/* Badge a capo su tablet e mobile */
@media (max-width: 992px) {
    .badge-capoluogo,
    .badge-commissariato,
    .badge-commissariata,
    .badge-metro {
        display: block;
        margin-left: 0;
        margin-top: 0.5rem;
        width: fit-content;
    }
}

.sindaco-card {
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
    color: white;
    border-radius: var(--radius-box);
    padding: 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.sindaco-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/img/bg-fascia.png') right center no-repeat;
    background-size: auto 150%;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.sindaco-card > * {
    position: relative;
    z-index: 1;
}

.sindaco-card.commissario {
    background: linear-gradient(135deg, #dc3545, #b91c1c);
}

.sindaco-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.sindaco-name {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.sindaco-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.sindaco-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.sindaco-info-item i {
    opacity: 0.8;
}

.info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-list li {
    display: flex;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f3f4;
}

.info-list li:last-child {
    border-bottom: none;
}

.info-label {
    width: 140px;
    color: #6c757d;
    font-size: 0.9rem;
}

.info-value {
    flex: 1;
    font-weight: 500;
}

.info-value a {
    color: #0d6efd;
    text-decoration: none;
}

.info-value a:hover {
    text-decoration: underline;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #f1f3f4;
}

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

.contact-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0d6efd;
}

.contact-info {
    flex: 1;
}

.contact-label {
    font-size: 0.8rem;
    color: #6c757d;
}

.contact-value {
    font-weight: 500;
    overflow-wrap: break-word;
    word-break: break-word;
}

.contact-value a {
    color: #0d6efd;
    text-decoration: none;
    overflow-wrap: break-word;
    word-break: break-word;
}

.contact-value a:hover {
    text-decoration: underline;
}

#map {
    height: 300px;
    border-radius: var(--radius-box);
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.news-item {
    display: block;
    padding: 1rem 0;
    border-bottom: 1px solid #f1f3f4;
    text-decoration: none;
    transition: all 0.2s ease;
}

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

.news-item:hover {
    background: #f8f9fa;
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

.news-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.news-item:hover .news-title {
    color: #0d6efd;
}

.news-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.75rem;
    color: #6c757d;
}

.news-source {
    color: #0d6efd;
}

.news-date {
    color: #6c757d;
}

.page-header.comune-detail + main .card-title {
    color: #293241;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header.comune-detail + main .card-title i {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3d8bfd, #0d6efd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.page-header.comune-detail + main .amm-role {
    color: #0d6efd;
}

.page-header.comune-detail + main .admin-tabs .nav-link.active {
    color: #0d6efd;
    border-bottom-color: #0d6efd;
}

.page-header.comune-detail + main .admin-tabs .nav-link.active .badge {
    background: #0d6efd;
}

@media (max-width: 768px) {
    .comune-title {
        font-size: 1.75rem;
    }
    
    .sindaco-name {
        font-size: 1.5rem;
    }
    
    .info-label {
        width: 100px;
    }
}

/* Info List Mobile - Layout Verticale */
@media (max-width: 767.98px) {
    .info-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
        padding: 0.6rem 0;
    }
    
    .info-label {
        width: 100% !important;
        font-size: 0.75rem;
        color: #6c757d;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .info-value {
        width: 100%;
        font-size: 0.95rem;
        font-weight: 600;
    }
}

/* Previeni auto-detection telefono su codici fiscali/ISTAT */
.no-phone-detect,
.no-phone-detect a {
    color: inherit !important;
    text-decoration: none !important;
    pointer-events: none;
}

.stat-box {
    text-align: center;
    padding: 1.5rem;
    background: white;
    border-radius: var(--radius-box);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.stat-box .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #0d6efd;
}

.stat-box .stat-label {
    font-size: 0.9rem;
    color: #6c757d;
}

/* =================================================================
   GENDER BARS
   ================================================================= */
.gender-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 2rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    height: 100%;
}

.gender-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gender-card-title i {
    color: #293241;
}

.gender-bar-container {
    margin-bottom: 1rem;
}

.gender-bar {
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
}

.gender-bar-male {
    background: linear-gradient(90deg, #7DDFFF, #32C5FF);
    height: 100%;
    width: 0;
    transition: width 1s ease-out;
}

.gender-bar-female {
    background: linear-gradient(90deg, #FF6EB4, #e84393);
    height: 100%;
    width: 0;
    transition: width 1s ease-out;
}

.gender-bar-male.animated,
.gender-bar-female.animated {
    /* La larghezza viene impostata inline, questa classe attiva la transizione */
}

.gender-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.gender-legend .male {
    color: #32C5FF;
    font-weight: 500;
}

.gender-legend .female {
    color: #e84393;
    font-weight: 500;
}

.gender-numbers {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.gender-stat {
    text-align: center;
}

.gender-stat-number {
    font-size: 1.5rem;
    font-weight: 700;
}

.gender-stat-number.male {
    color: #32C5FF;
}

.gender-stat-number.female {
    color: #e84393;
}

.gender-stat-label {
    font-size: 0.8rem;
    color: #6c757d;
}

/* =================================================================
   TABLES
   ================================================================= */
.table-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    overflow-x: auto;
}

.table-card table {
    width: 100%;
    margin-bottom: 0;
}

.table-card th {
    background: var(--light-bg);
    font-weight: 600;
    color: var(--text-dark);
}

.table-card td,
.table-card th {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

/* =================================================================
   FOOTER
   ================================================================= */
.footer {
    background: #091D3C;
    color: rgba(255,255,255,0.9);
    padding: 3rem 0;
    margin-top: 3rem;
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #009246 0%, #009246 33.33%, #ffffff 33.33%, #ffffff 66.66%, #ce2b37 66.66%, #ce2b37 100%);
}

.footer a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
}

.footer a:hover {
    color: white;
    text-decoration: underline;
}

.footer-links {
    font-size: 0.9rem;
}

.footer-logo {
    height: 50px;
    width: auto;
    filter: brightness(0) invert(1);
}

/* =================================================================
   UTILITIES
   ================================================================= */
.section-padding {
    padding: 5rem 0;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: #293241;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    color: #6c757d;
    margin-bottom: 3rem;
}

.icon-italy {
    width: 32px;
    height: auto;
    vertical-align: middle;
    filter: brightness(0) invert(1);
}

/* =================================================================
   SPINNER / LOADING
   ================================================================= */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* =================================================================
   HOMEPAGE
   ================================================================= */
.hero-section {
    background: #0d6efd;
    min-height: 70vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: visible;
    z-index: 10;
    padding-top: 80px;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/img/bg-header.png') left center no-repeat;
    background-size: auto 130%;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #009246 0%, #009246 33.33%, #ffffff 33.33%, #ffffff 66.66%, #ce2b37 66.66%, #ce2b37 100%);
}

.hero-content { position: relative; z-index: 1; }

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, #009246 0%, #009246 30%, #ffffff 45%, #ffffff 55%, #ce2b37 70%, #ce2b37 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.3rem;
    color: rgba(255,255,255,0.85);
    margin-bottom: 2rem;
}

/* Search Container */
.search-container {
    background: white;
    border-radius: var(--radius-box);
    box-shadow: 0 25px 80px rgba(0,0,0,0.2);
    padding: 0;
    overflow: visible;
    max-width: 700px;
    position: relative;
    z-index: 100;
    border: 1px solid rgba(255,255,255,0.2);
}

.search-tabs {
    display: flex;
    border-bottom: none;
    background: #f1f5f9;
    border-radius: var(--radius-box) var(--radius-box) 0 0;
    padding: 8px;
    gap: 8px;
}

.search-tab {
    flex: 1;
    padding: 1rem 1.5rem;
    text-align: center;
    cursor: pointer;
    background: transparent;
    border: none;
    border-radius: var(--radius-box);
    font-weight: 600;
    color: #64748b;
    transition: all 0.3s ease;
}

.search-tab:hover {
    background: rgba(255,255,255,0.5);
    color: #334155;
}

.search-tab.active {
    background: white;
    color: #0d6efd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.search-tab i {
    margin-right: 10px;
    font-size: 1.1rem;
    color: #0d6efd;
}

.search-panel {
    padding: 2rem 2.5rem 2.5rem;
    display: none;
}

.search-panel.active {
    display: block;
}

.search-input-wrapper {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1.25rem 1.5rem 1.25rem 3.5rem;
    font-size: 1.1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-box);
    transition: all 0.3s ease;
    background: #f8fafc;
}

.search-input:focus {
    outline: none;
    border-color: #1e4299;
    box-shadow: 0 0 0 4px rgba(30, 66, 153, 0.15);
    background: white;
}

.search-input::placeholder {
    color: #94a3b8;
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.search-input:focus + .search-icon,
.search-input-wrapper:focus-within .search-icon {
    color: #1e4299;
}

/* Autocomplete */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-box);
    margin-top: 12px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
}

.autocomplete-results.show {
    display: block;
}

.autocomplete-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    text-align: left;
}

.autocomplete-item:first-child {
    border-radius: var(--radius-box) var(--radius-box) 0 0;
}

.autocomplete-item:last-child {
    border-bottom: none;
    border-radius: 0 0 var(--radius-box) var(--radius-box);
}

.autocomplete-item:hover {
    background: linear-gradient(90deg, #f8fafc, #f1f5f9);
    padding-left: 1.75rem;
}

.autocomplete-item .main-text {
    font-weight: 600;
    color: #1e3a5f;
    margin-bottom: 4px;
    font-size: 1rem;
    text-align: left;
}

.autocomplete-item .sub-text {
    font-size: 0.85rem;
    color: #64748b;
    text-align: left;
}

.autocomplete-item .badge-carica {
    font-size: 0.75rem;
    padding: 5px 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: #4338ca;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Stats Section */
.stats-section {
    padding: 4rem 0;
    background: var(--light-bg);
}

.stats-section .stat-card {
    padding: 3.5rem 1.5rem;
}

/* Territory Cards */
.territory-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    height: 100%;
}

.territory-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #DEE2E6;
}

.territory-role {
    margin-bottom: 1rem;
}

.territory-role-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.mini-bar {
    height: 8px;
    border-radius: 4px;
    background: #e9ecef;
    overflow: hidden;
    display: flex;
}

.mini-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-top: 4px;
}

.mini-stats .male {
    color: #32C5FF;
}

.mini-stats .female {
    color: #e84393;
}

/* Age Cards */
.age-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 2rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    height: 100%;
    text-align: center;
}

/* Age Section con sfondo blu */
.age-section {
    background: #0d6efd;
    position: relative;
}

.age-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/img/bg-fascia.png') right center no-repeat;
    background-size: auto 100%;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.age-section .container {
    position: relative;
    z-index: 1;
}

.age-section .section-title,
.age-section .section-subtitle {
    color: white;
}

.age-section .section-subtitle {
    opacity: 0.9;
}

.age-big-number {
    font-size: 4rem;
    font-weight: 700;
    color: #293241;
    line-height: 1;
}

.age-label {
    font-size: 1rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

.age-icon {
    margin-top: 1rem;
    font-size: 1.25rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3d8bfd, #0d6efd);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-left: auto;
    margin-right: auto;
}

.age-highlight-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--radius-box);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.age-highlight-card.young {
    background: linear-gradient(135deg, #6DD400, #AAED63);
}

.age-highlight-card.old {
    background: linear-gradient(135deg, #495057, #6c757d);
}

.age-highlight-card.imprese-crisi {
    background: linear-gradient(135deg, #dc3545, #a82030);
}

.age-highlight-card.imprese-regioni {
    background: linear-gradient(135deg, #dc3545, #a82030);
}

.age-highlight-title {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.age-highlight-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.age-highlight-info {
    font-size: 0.85rem;
    opacity: 0.9;
}

.age-highlight-age {
    font-size: 2rem;
    font-weight: 700;
}

/* Age Distribution */
.age-distribution {
    margin-top: 2rem;
}

.age-dist-bar {
    display: flex;
    height: 40px;
    border-radius: var(--radius-box);
    overflow: hidden;
    margin-bottom: 1rem;
}

.age-dist-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    transition: width 0.8s ease-out;
}

.age-dist-segment:hover {
    filter: brightness(1.1);
}

.age-dist-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.age-dist-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.age-dist-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* Education Card */
.education-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 2rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.education-row {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.education-row:last-child {
    margin-bottom: 0;
}

.education-label {
    width: 120px;
    font-weight: 600;
    color: var(--text-dark);
}

.education-bars {
    flex: 1;
    display: flex;
    gap: 4px;
}

.education-bar {
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 40px;
    transition: all 0.3s ease;
}

.education-bar:hover {
    transform: scaleY(1.1);
}

.edu-laurea {
    background: #6DD400;
}

.edu-diploma {
    background: #1EC997;
}

.edu-media {
    background: #14A2B8;
}

.edu-altro {
    background: #6c757d;
}

/* Donut Charts */
.donut-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.donut-chart {
    position: relative;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut-chart::before {
    content: '';
    position: absolute;
    width: 160px;
    height: 160px;
    background: white;
    border-radius: 50%;
    z-index: 1;
}

.donut-center {
    position: relative;
    z-index: 2;
    text-align: center;
}

.donut-center-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3d8bfd, #0d6efd);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    margin: 0 auto;
}

.donut-segments {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.donut-segment {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    clip-path: polygon(50% 50%, 50% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, 50% 0%);
    cursor: pointer;
}

.donut-segment:hover + .donut-tooltip,
.donut-segment:hover ~ .donut-tooltip {
    opacity: 1;
}

.donut-tooltip {
    position: absolute;
    background: #293241;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.donut-legend {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #6c757d;
}

.donut-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Ranking Card */
.ranking-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 2rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.ranking-item {
    display: grid;
    grid-template-columns: 40px 1fr 150px 60px 80px;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: 1px solid #f1f3f4;
    gap: 0.5rem;
}

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

.ranking-position {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.ranking-position.gold {
    background: #e84393;
    color: #fff;
}

.ranking-position.silver {
    background: #f06aaf;
    color: #fff;
}

.ranking-position.bronze {
    background: #f8a5cd;
    color: #fff;
}

.ranking-position.normal {
    background: #e9ecef;
    color: var(--text-dark);
}

.ranking-name {
    font-weight: 500;
}

.ranking-bar-container {
    width: 150px;
}

.ranking-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.ranking-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF6EB4, #e84393);
    border-radius: 4px;
}

.ranking-value {
    font-weight: 700;
    color: #e84393;
    min-width: 50px;
    text-align: right;
}

.ranking-count {
    font-size: 0.8rem;
    color: #6c757d;
    min-width: 60px;
    text-align: right;
}

.ranking-item-last {
    border-bottom: 1px solid #f1f3f4 !important;
}

/* Profession List Mobile */
.profession-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profession-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f3f4;
}

.profession-list-item:last-child {
    border-bottom: none;
}

.profession-list-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profession-list-icon i {
    color: white;
    font-size: 14px;
}

.profession-list-content {
    flex: 1;
    min-width: 0;
}

.profession-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.profession-list-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
}

.profession-list-value {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
}

.profession-list-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.profession-list-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Mobile: fix doppio separatore tra colonna 1 e 2 nella classifica */
@media (max-width: 767.98px) {
    /* Rimuove border-bottom dall'ultimo item della prima colonna */
    .gender-card .row.g-4 > .col-md-6:first-of-type .ranking-item-last {
        border-bottom: none !important;
    }
    
    /* Compensa il gap Bootstrap tra le due colonne per avere spazio uniforme */
    .gender-card .row.g-4 > .col-md-6:last-of-type {
        margin-top: -0.5rem;
    }
}


/* Profession Items */
.profession-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f1f3f4;
}

.profession-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.profession-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.85rem;
    color: white;
    font-size: 0.9rem;
}

.profession-info {
    flex: 1;
    margin-right: 1rem;
}

.profession-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.profession-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.profession-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--primary-color);
}

.profession-count {
    font-weight: 600;
    color: var(--text-dark);
    min-width: 60px;
    text-align: right;
}

/* Profession Distribution Bar */
.profession-distribution {
    margin-top: 1rem;
}

.profession-bar {
    margin-bottom: 1.5rem;
    height: 90px;
    border-radius: var(--radius-box);
}

.profession-segment {
    min-width: 30px;
    font-size: 0.85rem;
}

.profession-segment .segment-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: white;
}

.profession-segment .segment-content i {
    font-size: 1.4rem;
}

.profession-legend {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem 1.5rem;
}

@media (max-width: 992px) {
    .profession-legend {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .profession-legend {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .profession-bar {
        height: 60px;
    }
    
    .profession-segment .segment-content i {
        font-size: 1.1rem;
    }
}

/* Feature Cards */
.feature-card {
    padding: 2rem;
    border-radius: var(--radius-box);
    background: white;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.feature-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.feature-icon i {
    font-size: 1.5rem;
    color: white;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.feature-text {
    color: #6c757d;
    line-height: 1.7;
}

.irpef-card {
    border-left: none !important;
}

/* IRPEF Grid - stack verticale su mobile */
@media (max-width: 767.98px) {
    .irpef-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Rimuove border-left dal box Media Nazionale in homepage */
.section-padding .row .col-md-4:first-child > div {
    border-left: none !important;
}

/* =================================================================
   SCHEDA PROVINCIA
   ================================================================= */
.page-header.provincia-detail {
    background: #0d6efd;
}

.page-header.provincia-detail.commissariata {
    background: linear-gradient(135deg, #c44d34 0%, #dc3545 100%);
}

.provincia-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.provincia-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.badge-commissariata {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-left: 1rem;
}

.badge-metro {
    background: rgba(255,255,255,0.3);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-left: 1rem;
}

.commissario-card {
    background: linear-gradient(135deg, #c44d34, #dc3545);
    color: white;
    border-radius: var(--radius-box);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.comuni-list {
    max-height: 400px;
    overflow-y: auto;
}

.comune-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f3f4;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.2s ease;
}

.comune-item:hover {
    background: #f8f9fa;
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

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

.comune-item .comune-nome {
    font-weight: 500;
}

.comune-item:hover .comune-nome {
    color: #0d6efd;
}

.comune-item .comune-abitanti {
    font-size: 0.8rem;
    color: #6c757d;
}

.page-header.provincia-detail + main .card-title {
    color: #293241;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header.provincia-detail + main .card-title i {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3d8bfd, #0d6efd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.page-header.provincia-detail + main .amm-role {
    color: #0d6efd;
}

.page-header.provincia-detail + main .presidente-card {
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
}

@media (max-width: 768px) {
    .provincia-title {
        font-size: 1.75rem;
    }
}

/* =================================================================
   RESPONSIVE
   ================================================================= */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .age-big-number {
        font-size: 3rem;
    }
    
    .ranking-bar-container {
        display: none;
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .header-nav {
        gap: 1rem;
        font-size: 0.85rem;
    }
    
    .header-logo {
        height: 32px;
    }
    
    .content-card {
        padding: 1.5rem;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .gender-card {
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .page-title {
        font-size: 1.5rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 1.25rem;
    }
}

/* =================================================================
   PAGINA COMUNI COMMISSARIATI
   ================================================================= */
.page-header.commissariati {
    background: #0d6efd;
}

.stat-icon.commissariati {
    background: linear-gradient(135deg, #3d8bfd, #0d6efd);
}

.regione-header.commissariati {
    background: #0d6efd;
}

.commissariati-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1rem;
}

.commissariato-card {
    background: white;
    border-radius: var(--radius-box);
    padding: 1.25rem;
    border-left: 4px solid #dc3545;
    box-shadow: 0 3px 15px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
}

.commissariato-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.commissariato-nome {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.commissariato-nome a {
    color: inherit;
    text-decoration: none;
}

.commissariato-nome a:hover {
    color: #0d6efd;
}

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

.commissario-info {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 0.75rem;
}

.commissario-info .commissario-nome {
    font-weight: 500;
    color: #1e3a5f !important;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.commissario-info .commissario-nome i {
    color: #1e3a5f !important;
}

.commissario-carica {
    font-size: 0.8rem;
    color: #dc3545;
}

.commissario-data {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.abitanti-badge {
    display: inline-block;
    background: #e9ecef;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #6c757d;
}

@media (max-width: 768px) {
    .commissariati-grid {
        grid-template-columns: 1fr;
    }
}

/* =================================================================
   OTTIMIZZAZIONI RESPONSIVE COMPLETE
   Aggiornato: 21 Gennaio 2026
   ================================================================= */

/* -----------------------------------------------------------------
   MOBILE PICCOLO (max-width: 375px)
   ----------------------------------------------------------------- */
@media (max-width: 375px) {
    /* Hero Section */
    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    .hero-section {
        min-height: auto;
        padding-top: 60px;
        padding-bottom: 3.5rem;
    }
    
    .hero-logo {
        height: 80px !important;
    }
    
    /* Search Container */
    .search-container {
        margin: 0 -15px;
        border-radius: 0;
    }
    
    .search-panel {
        padding: 1rem 1rem 1.5rem;
    }
    
    .search-input {
        font-size: 1rem;
        padding: 1rem 1rem 1rem 3rem;
    }
    
    .search-tabs {
        padding: 6px;
        gap: 4px;
    }
    
    .search-tab {
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .search-tab i {
        display: none;
    }
    
    /* Stat Cards */
    .stat-card {
        padding: 1rem 0.75rem;
    }
    
    .stat-number {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    /* Age Section */
    .age-big-number {
        font-size: 2.5rem;
    }
    
    .age-label {
        font-size: 0.85rem;
    }
    
    .age-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .age-highlight-card {
        padding: 1rem;
    }
    
    .age-highlight-name {
        font-size: 0.95rem;
    }
    
    .age-highlight-age {
        font-size: 1.5rem;
    }
    
    /* Donut Charts */
    .donut-chart {
        width: 200px;
        height: 200px;
    }
    
    .donut-chart::before {
        width: 110px;
        height: 110px;
    }
    
    .donut-center-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .donut-legend {
        gap: 0.5rem;
    }
    
    .donut-legend-item {
        font-size: 0.75rem;
    }
    
    /* Gender Cards */
    .gender-card {
        padding: 1rem;
    }
    
    .gender-card-title {
        font-size: 1rem;
    }
    
    .gender-stat-number {
        font-size: 1.25rem;
    }
    
    /* Rankings */
    .ranking-item {
        grid-template-columns: 28px 1fr auto auto;
        gap: 0.35rem;
        padding: 1rem 0;
    }
    
    .ranking-name {
        font-size: 0.85rem;
    }
    
    .ranking-value {
        font-size: 0.85rem;
        min-width: 40px;
    }
    
    .ranking-count {
        font-size: 0.7rem;
        min-width: 50px;
    }
    
    /* Page Headers */
    .page-title {
        font-size: 1.35rem;
    }
    
    .page-subtitle {
        font-size: 0.9rem;
    }
    
    .page-header {
        padding: 2rem 0;
        padding-top: calc(2rem + 100px);
    }
    
    /* Scheda Comune/Provincia/Regione */
    .comune-title,
    .provincia-title,
    .regione-title {
        font-size: 1.35rem;
    }
    
    .sindaco-card,
    .presidente-card,
    .commissario-card {
        padding: 1.25rem;
    }
    
    .sindaco-name,
    .presidente-name {
        font-size: 1.25rem;
    }
    
    .sindaco-info,
    .presidente-info {
        gap: 0.75rem;
    }
    
    .sindaco-info-item,
    .presidente-info-item {
        font-size: 0.8rem;
    }
    
    /* Info List - layout verticale su mobile */
    .info-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .info-label {
        width: 100%;
        font-size: 0.8rem;
        margin-bottom: 0;
    }
    
    .info-value {
        font-size: 0.95rem;
        width: 100%;
    }
    
    /* Contact Items */
    .contact-item {
        gap: 0.75rem;
    }
    
    .contact-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .contact-value {
        font-size: 0.85rem;
    }
    
    /* Cards */
    .info-card,
    .content-card {
        padding: 1rem;
    }
    
    .card-title {
        font-size: 1.1rem !important;
        gap: 8px !important;
    }
    
    .card-title i {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        font-size: 1rem !important;
    }
    
    /* Tabelle */
    .table-indennita {
        font-size: 0.75rem;
    }
    
    .table-indennita th,
    .table-indennita td {
        padding: 0.5rem 0.35rem;
    }
    
    .table-indennita .importo {
        font-size: 0.9rem;
    }
    
    /* Breadcrumb */
    .breadcrumb-custom {
        font-size: 0.75rem;
    }
    
    .breadcrumb-custom .separator {
        margin: 0 0.35rem;
    }
    
    /* Section Titles */
    .section-title {
        font-size: 1.35rem;
    }
    
    .section-subtitle {
        font-size: 0.9rem;
    }
    
    /* Footer */
    .footer {
        padding: 2rem 0;
    }
    
    .footer-logo {
        height: 35px;
    }
}

/* -----------------------------------------------------------------
   MOBILE STANDARD (max-width: 576px)
   ----------------------------------------------------------------- */
@media (max-width: 576px) {
    /* Hero Section */
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    .hero-subtitle br {
        display: none;
    }
    
    .hero-section {
        min-height: auto;
        padding-bottom: 4rem;
    }
    
    .hero-logo {
        height: 90px !important;
    }
    
    /* Search Container */
    .search-panel {
        padding: 1.25rem 1.5rem 1.75rem;
    }
    
    .search-tab {
        padding: 0.85rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .search-tab i {
        margin-right: 6px;
        font-size: 1rem;
    }
    
    /* Autocomplete */
    .autocomplete-results {
        max-height: 300px;
    }
    
    .autocomplete-item {
        padding: 0.85rem 1rem;
    }
    
    .autocomplete-item .main-text {
        font-size: 0.9rem;
    }
    
    .autocomplete-item .sub-text {
        font-size: 0.8rem;
    }
    
    .autocomplete-item .badge-carica {
        font-size: 0.65rem;
        padding: 4px 8px;
    }
    
    /* Stats Section */
    .stats-section .stat-card {
        padding: 2rem 1rem;
    }
    
    /* Age Section */
    .age-card {
        padding: 1.5rem;
    }
    
    .age-big-number {
        font-size: 2.75rem;
    }
    
    .age-highlight-card {
        padding: 1.25rem;
    }
    
    .age-highlight-age {
        font-size: 1.75rem;
    }
    
    /* Age Distribution */
    .age-dist-bar {
        height: 32px;
    }
    
    .age-dist-segment {
        font-size: 0.65rem;
    }
    
    .age-dist-legend {
        gap: 0.5rem 1rem;
    }
    
    .age-dist-legend-item {
        font-size: 0.75rem;
    }
    
    /* Donut Charts */
    .donut-chart {
        width: 220px;
        height: 220px;
    }
    
    .donut-chart::before {
        width: 120px;
        height: 120px;
    }
    
    /* Gender Cards */
    .gender-card {
        padding: 1.25rem;
    }
    
    .gender-card-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .gender-stat-number {
        font-size: 1.35rem;
    }
    
    .gender-stat-label {
        font-size: 0.7rem;
    }
    
    /* Rankings */
    .ranking-item {
        grid-template-columns: 28px 1fr auto auto;
        padding: 1rem 0;
    }
    
    .ranking-position {
        width: 26px;
        height: 26px;
        font-size: 0.75rem;
    }
    
    .ranking-name {
        font-size: 0.9rem;
    }
    
    .ranking-value {
        min-width: 45px;
    }
    
    .ranking-count {
        min-width: 55px;
    }
    
    /* Territory Cards */
    .territory-card {
        padding: 1.25rem;
    }
    
    .territory-title {
        font-size: 1rem;
    }
    
    .territory-role-title {
        font-size: 0.8rem;
    }
    
    .mini-stats {
        font-size: 0.7rem;
    }
    
    /* Feature Cards */
    .feature-card {
        padding: 1.5rem;
    }
    
    .feature-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 1rem;
    }
    
    .feature-icon i {
        font-size: 1.25rem;
    }
    
    .feature-title {
        font-size: 1.1rem;
    }
    
    .feature-text {
        font-size: 0.9rem;
    }
    
    /* Page Headers */
    .page-title {
        font-size: 1.5rem;
    }
    
    .comune-title,
    .provincia-title,
    .regione-title {
        font-size: 1.5rem;
    }
    
    .comune-subtitle,
    .provincia-subtitle,
    .regione-subtitle {
        font-size: 1rem;
    }
    
    /* Badges */
    .badge-capoluogo,
    .badge-commissariato,
    .badge-commissariata,
    .badge-metro {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
    
    /* Sindaco/Presidente Card */
    .sindaco-card,
    .presidente-card,
    .commissario-card {
        padding: 1.5rem;
    }
    
    .sindaco-name,
    .presidente-name {
        font-size: 1.35rem;
    }
    
    .sindaco-info,
    .presidente-info {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .sindaco-info-item,
    .presidente-info-item {
        font-size: 0.85rem;
    }
    
    /* Vice Card */
    .vice-card {
        padding: 1rem;
    }
    
    .vice-name {
        font-size: 1rem;
    }
    
    /* Stat Boxes (schede) */
    .stat-box {
        padding: 1rem;
    }
    
    .stat-box .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-box .stat-label {
        font-size: 0.75rem;
    }
    
    /* Admin Tabs */
    .admin-tabs {
        flex-wrap: wrap;
    }
    
    .admin-tabs .nav-link {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    .admin-tabs .nav-link .badge {
        font-size: 0.7rem;
    }
    
    /* Amm Grid */
    .amm-grid {
        grid-template-columns: 1fr;
    }
    
    .amm-card {
        padding: 1rem;
    }
    
    .amm-name {
        font-size: 0.95rem;
    }
    
    .amm-role {
        font-size: 0.8rem;
    }
    
    .amm-details {
        font-size: 0.75rem;
    }
    
    /* News List */
    .news-item {
        padding: 0.85rem 0;
    }
    
    .news-title {
        font-size: 0.9rem;
    }
    
    .news-meta {
        font-size: 0.7rem;
    }
    
    /* Info Cards */
    .info-card,
    .content-card {
        padding: 1.25rem;
    }
    
    .info-card h5 {
        font-size: 1rem;
    }
    
    /* Info List */
    .info-list li {
        padding: 0.6rem 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
    }
    
    .info-label {
        width: 100%;
        font-size: 0.75rem;
        color: #6c757d;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .info-value {
        width: 100%;
        font-size: 0.95rem;
    }
    
    /* Contact Items */
    .contact-item {
        padding: 0.85rem 0;
    }
    
    /* Map */
    #map {
        height: 220px;
    }
    
    /* Grids */
    .regioni-grid,
    .citta-grid,
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .province-grid {
        gap: 0.85rem;
    }
    
    /* Regione Card */
    .regione-card,
    .citta-card,
    .card-item {
        padding: 1.25rem;
    }
    
    .regione-nome,
    .citta-nome,
    .card-item-title {
        font-size: 1.1rem;
    }
    
    .regione-stats,
    .citta-stats,
    .card-item-stats {
        gap: 0.5rem;
    }
    
    .regione-stat-value,
    .citta-stat-value,
    .card-item-stat-value {
        font-size: 1rem;
    }
    
    .regione-stat-label,
    .citta-stat-label,
    .card-item-stat-label {
        font-size: 0.65rem;
    }
    
    /* Provincia Card */
    .provincia-card {
        padding: 1rem;
    }
    
    .provincia-nome {
        font-size: 1rem;
    }
    
    .provincia-stats {
        font-size: 0.75rem;
        gap: 0.75rem;
    }
    
    /* Regione Header */
    .regione-header {
        padding: 0.85rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .regione-header h3 {
        font-size: 1.1rem;
    }
    
    /* Comuni Grid */
    .comuni-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .comune-card {
        padding: 0.85rem 1rem;
    }
    
    .comune-nome {
        font-size: 0.95rem;
    }
    
    .comune-prov {
        font-size: 0.75rem;
    }
    
    .comune-abitanti {
        font-size: 0.8rem;
    }
    
    .comune-abitanti strong {
        font-size: 0.95rem;
    }
    
    /* Alphabet Filter */
    .alphabet-filter {
        gap: 0.35rem;
    }
    
    .alphabet-filter a {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .alphabet-filter a.all {
        padding: 0 0.75rem;
    }
    
    /* Pagination */
    .pagination .page-link {
        padding: 0.4rem 0.65rem;
        font-size: 0.85rem;
    }
    
    /* Tabelle */
    .table-card {
        padding: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-indennita {
        font-size: 0.8rem;
        min-width: 0 !important; /* Rimosso min-width: 500px che causava overflow */
        table-layout: fixed !important;
        width: 100% !important;
    }
    
    /* Indennità Page */
    .icon-card {
        padding: 1.5rem;
    }
    
    .icon-card .icon-wrapper {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .icon-card h4 {
        font-size: 1.1rem;
    }
    
    .icon-card p {
        font-size: 0.85rem;
    }
    
    .info-box,
    .warning-box {
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
    }
    
    .percentuale-badge {
        font-size: 0.8rem;
        padding: 0.2rem 0.6rem;
    }
    
    /* Sidebar */
    .sidebar-card {
        position: static !important;
        padding: 1.25rem;
    }
    
    .toc-list a {
        padding: 0.4rem 0.85rem;
        font-size: 0.9rem;
    }
    
    /* Cost Cards (Indennità) */
    .cost-card,
    .total-box {
        padding: 1.25rem !important;
    }
    
    .total-box div[style*="font-size: 3rem"],
    .total-box div[style*="font-size: 3.5rem"] {
        font-size: 2rem !important;
    }
    
    .total-box div[style*="font-size: 2.5rem"] {
        font-size: 1.75rem !important;
    }
    
    /* Commissariati Grid */
    .commissariati-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .commissariato-card {
        padding: 1rem;
    }
    
    /* Header */
    .site-header {
        padding: 0.85rem 0;
    }
    
    .header-logo {
        height: 36px;
    }
    
    /* Footer */
    .footer {
        padding: 2rem 0;
        margin-top: 2rem;
    }
    
    .footer-links {
        font-size: 0.85rem;
    }
    
    .footer-logo {
        height: 40px;
    }
    
    /* Breadcrumb */
    .breadcrumb-custom {
        font-size: 0.8rem;
        line-height: 1.6;
    }
}

/* -----------------------------------------------------------------
   TABLET PORTRAIT (max-width: 768px)
   ----------------------------------------------------------------- */
@media (max-width: 991.98px) {
    /* Rankings - nascondi barra e semplifica grid */
    .ranking-bar-container {
        display: none;
    }
    
    .ranking-item {
        grid-template-columns: 30px 1fr auto auto;
    }
    
    /* Gender Card Columns */
    .gender-card .row.g-4 > .col-md-6:first-child {
        padding-bottom: 0;
    }
    
    .gender-card .row.g-4 > .col-md-6:last-child .ranking-item:first-child {
        border-top: 1px solid #f1f3f4;
        padding-top: 1rem;
    }
    
    /* Age Cards Row */
    .age-card {
        margin-bottom: 0;
    }
    
    /* Province Grid in Regione page */
    .province-grid {
        gap: 1rem;
    }
    
    /* Comuni List */
    .comuni-list {
        max-height: 300px;
    }
    
    /* Tables scroll indicator */
    .table-card::after {
        content: '\2192 Scorri per vedere tutto';
        display: block;
        text-align: center;
        font-size: 0.75rem;
        color: #6c757d;
        padding-top: 0.5rem;
        margin-top: 0.5rem;
        border-top: 1px dashed #dee2e6;
    }
}

/* -----------------------------------------------------------------
   TABLET PORTRAIT (576px - 991.98px) - DONUT CHARTS FIX
   ----------------------------------------------------------------- */
@media (min-width: 576px) and (max-width: 991.98px) {
    /* Donut Charts - dimensioni ridotte per tablet */
    .donut-chart {
        width: 180px;
        height: 180px;
    }
    
    .donut-chart::before {
        width: 100px;
        height: 100px;
    }
    
    .donut-center-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .donut-legend {
        gap: 0.4rem;
    }
    
    .donut-legend-item {
        font-size: 0.7rem;
    }
    
    .donut-legend-color {
        width: 10px;
        height: 10px;
    }
    
    /* Gender card title più compatto */
    .gender-card h4 {
        font-size: 1rem !important;
    }
    
    /* Stat Cards - numeri ridotti per tablet */
    .stat-card {
        padding: 1rem 0.75rem;
    }
    
    .stat-number {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }
    
    /* Stat Box (pagine interne) */
    .stat-box {
        padding: 1rem;
    }
    
    .stat-box .stat-number {
        font-size: 1.35rem;
    }
    
    .stat-box .stat-label {
        font-size: 0.75rem;
    }
    
    /* Age big numbers */
    .age-big-number {
        font-size: 2.5rem;
    }
    
    .age-label {
        font-size: 0.85rem;
    }
    
    .age-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    /* Gender stat numbers */
    .gender-stat-number {
        font-size: 1.1rem;
    }
    
    .gender-stat-label {
        font-size: 0.65rem;
    }
    
    /* Card titles */
    .card-title {
        font-size: 1.1rem !important;
        gap: 8px !important;
    }
    
    .card-title i {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        font-size: 1rem !important;
    }
    
    /* Info card */
    .info-card h5 {
        font-size: 0.95rem;
    }
    
    /* Regione/Citta stat values */
    .regione-stat-value,
    .citta-stat-value,
    .card-item-stat-value {
        font-size: 0.95rem;
    }
    
    .regione-stat-label,
    .citta-stat-label,
    .card-item-stat-label {
        font-size: 0.6rem;
    }
}

/* -----------------------------------------------------------------
   TABLET LANDSCAPE (max-width: 992px)
   ----------------------------------------------------------------- */
@media (max-width: 992px) {
    /* Hero */
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-section {
        min-height: 60vh;
    }
    
    /* Search */
    .search-container {
        max-width: 600px;
    }
    
    /* Rankings - show 2 columns still */
    .ranking-item {
        padding: 1rem 0;
    }
    
    /* Profession Legend */
    .profession-legend {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Grids */
    .regioni-grid,
    .citta-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Page Header */
    .page-header {
        padding: 2.5rem 0;
        padding-top: calc(2.5rem + 110px);
    }
    
    /* Content Card */
    .content-card {
        padding: 2rem;
    }
    
    /* Sidebar Sticky - disable on tablet */
    .sidebar-card[style*="sticky"] {
        position: static !important;
    }
}

/* -----------------------------------------------------------------
   DESKTOP PICCOLO (max-width: 1200px)
   ----------------------------------------------------------------- */
@media (max-width: 1200px) {
    /* Hero */
    .hero-title {
        font-size: 3rem;
    }
    
    /* Search */
    .search-container {
        max-width: 650px;
    }
    
    /* Stat Cards */
    .stat-card {
        padding: 2.5rem 1.25rem;
    }
    
    /* Grids */
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* -----------------------------------------------------------------
   TOUCH DEVICES
   ----------------------------------------------------------------- */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .search-tab {
        min-height: 48px;
    }
    
    .alphabet-filter a {
        min-width: 44px;
        min-height: 44px;
    }
    
    .pagination .page-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .comune-card,
    .provincia-card,
    .regione-card,
    .citta-card {
        min-height: 44px;
    }
    
    .nav-link {
        min-height: 44px;
    }
    
    /* Remove hover effects that don't work on touch */
    .stat-card:hover,
    .feature-card:hover,
    .regione-card:hover,
    .provincia-card:hover,
    .citta-card:hover,
    .comune-card:hover,
    .card-item:hover {
        transform: none;
    }
    
    /* But keep subtle feedback */
    .stat-card:active,
    .feature-card:active,
    .regione-card:active,
    .provincia-card:active,
    .citta-card:active,
    .comune-card:active,
    .card-item:active {
        opacity: 0.9;
    }
}

/* -----------------------------------------------------------------
   PRINT STYLES
   ----------------------------------------------------------------- */
@media print {
    .site-header,
    .footer,
    .search-container,
    .sidebar-card,
    #map {
        display: none !important;
    }
    
    .page-header {
        padding-top: 0 !important;
        background: none !important;
        color: #000 !important;
    }
    
    .page-header::before,
    .page-header::after {
        display: none !important;
    }
    
    .col-lg-8 {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .col-lg-4 {
        display: none !important;
    }
    
    .info-card,
    .content-card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}

/* -----------------------------------------------------------------
   LEGISLATURE BAR (barra anni giunta storica)
   ----------------------------------------------------------------- */
.legislature-bar {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 16px;
}

.legislature-bar .anno-btn {
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.legislature-bar .anno-btn.btn-primary {
    box-shadow: 0 2px 4px rgba(29, 78, 216, 0.3);
}

.legislature-bar .anno-btn.btn-outline-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

#boxContatti .contact-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

@media (max-width: 576px) {
    .legislature-bar .anno-btn {
        font-size: 0.75rem;
        padding: 3px 10px;
    }
}

/* Ciambelle cancellazioni - responsive */
@media (max-width: 576px) {
    .donut-canc-grid {
        grid-template-columns: 1fr !important;
    }
}

/* -----------------------------------------------------------------
   LANDSCAPE ORIENTATION FIXES
   ----------------------------------------------------------------- */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: 80px 0 40px;
    }
    
    .hero-logo {
        height: 60px !important;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
}
