/* File: /assets/css/style.css (Versione Finale Definitiva) */

/* --- STILI GENERALI --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    margin: 0;
    line-height: 1.6;
}
.main-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
a { color: #007bff; text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: 0; height: 1px; background: #ddd; margin: 20px 0; }

/* --- MESSAGGI DI FEEDBACK --- */
.error-message { background-color: #f8d7da; color: #721c24; padding: 10px; border: 1px solid #f5c6cb; border-radius: 4px; margin-bottom: 15px; }
.success-message { color: #155724; background-color: #d4edda; border-color: #c3e6cb; padding: 10px; margin-bottom: 15px; border-radius: 3px; }
.info-message { color: #0c5460; background-color: #d1ecf1; border-color: #bee5eb; padding: 10px; margin-bottom: 15px; border-radius: 3px; }

/* --- FORM GENERICI --- */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-size: 1em; }
.form-box, .table-box { margin-top: 30px; padding: 20px; border: 1px solid #ddd; border-radius: 8px; background-color: #fff; }
.form-row { display: flex; flex-wrap: wrap; gap: 20px; }
.form-row .form-group { flex: 1; min-width: 200px; }
.form-group-checkbox { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.form-group-checkbox input[type="checkbox"] { width: auto; transform: scale(1.3); }
.form-group-checkbox label { font-weight: normal; }

/* --- TABELLE GENERICHE --- */
.table-box table { width: 100%; border-collapse: collapse; }
.table-box th, .table-box td { padding: 12px; border: 1px solid #ddd; text-align: left; vertical-align: middle; }
.table-box thead { background-color: #f8f9fa; }
.table-box td small { color: #6c757d; }
.status-active { color: #28a745; font-weight: bold; }
.status-inactive { color: #dc3545; font-weight: bold; }
.text-center { text-align: center; }

/* --- DASHBOARD PROFESSIONALE --- */
.welcome-box { background-color: #e7f3fe; border-left: 5px solid #007bff; padding: 20px; margin-bottom: 20px; border-radius: 5px; }
.logout-button { display: inline-block; padding: 8px 15px; background-color: #dc3545; color: white; text-decoration: none; border-radius: 4px; font-weight: bold; }
.logout-button:hover { background-color: #c82333; }
.dashboard-main-content { margin-top: 30px; display: flex; flex-direction: column; gap: 30px; }
.dashboard-section { padding: 25px; border-radius: 8px; border: 1px solid #e9ecef; background-color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.section-title { margin-top: 0; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #eee; font-size: 1.4em; color: #343a40; }
.section-operational { border-top: 4px solid #007bff; }
.section-security { border-top: 4px solid #ffc107; }
.section-navigation { border-top: 4px solid #6c757d; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.dashboard-widget { background-color: #f8f9fa; border: 1px solid #dee2e6; border-radius: 5px; padding: 20px; }
.dashboard-widget h3 { margin-top: 0; border-bottom: 1px solid #ddd; padding-bottom: 10px; font-size: 1.1em; }
.table-box-widget { max-height: 250px; overflow-y: auto; }
.table-box-widget table { width: 100%; border-collapse: collapse; }
.table-box-widget th, .table-box-widget td { padding: 8px; border-bottom: 1px solid #f0f0f0; text-align: left; font-size: 0.9em; }
.table-box-widget tbody tr:nth-child(even) { background-color: #f9f9f9; }
.no-issues { padding: 20px; color: #155724; font-weight: bold; text-align: center; background-color: #d4edda; border-radius: 4px; }
.stats-box { display: flex; justify-content: center; align-items: center; padding: 20px 0; text-align: center; gap: 10px; }
.stat-item { padding: 0 10px; }
.stat-number { display: block; font-size: 2.5em; font-weight: bold; color: #007bff; }
.stat-label { font-size: 1em; color: #6c757d; }
.stat-divider { font-size: 2em; color: #ccc; }

/* --- PULSANTI --- */
.section-navigation nav { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.nav-button { display: block; width: 100%; max-width: 400px; box-sizing: border-box; padding: 12px 15px; background-color: #5a6268; color: white; text-decoration: none; border-radius: 8px; text-align: center; }
.nav-button:hover { background-color: #4a4f54; }

/* Stile per il separatore nel menu della dashboard */
.section-navigation nav p {
    width: 100%;
    height: 1px;
    background-color: #ddd;
    margin: 10px auto; /* Crea spazio verticale */
    padding: 0;
}


/* Stili per Widget Controllo Millesimi */
.millesimi-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}
.millesimi-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 5px;
    border-bottom: 1px solid #e9ecef;
}
.millesimi-list li:last-child {
    border-bottom: none;
}
.millesimi-list span:first-child {
    font-weight: 500;
}


/* Stili per Widget di Controllo Continuità */
.dashboard-widget.full-width {
    grid-column: 1 / -1; /* Fa in modo che il widget occupi tutte le colonne disponibili */
}
.continuita-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}
.continuita-list li {
    padding: 8px 5px;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.9em;
}
.continuita-list li:last-child {
    border-bottom: none;
}


/* Aggiungere alla fine del file /assets/css/style.css */

.continuita-subtitle {
    font-size: 1em;
    font-weight: bold;
    color: #495057;
    margin-top: 15px;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e9ecef;
}

.continuita-list > li:first-child {
    padding-top: 5px;
}

hr.continuita-divider {
    border: 0;
    height: 1px;
    background: #ced4da;
    margin: 15px 0;
}


.btn-secondary { background-color: #6c757d; color: white; padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer; }
.btn-secondary:hover { background-color: #5a6268; }
.btn-success { background-color: #28a745; color: white; padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer; }
.btn-back { display: inline-block; padding: 8px 15px; background-color: #6c757d; color: white; text-decoration: none; border-radius: 4px; margin-bottom: 20px; }
.btn-back:hover { background-color: #5a6268; }
.btn-edit, .btn-delete, .btn-action { display: inline-block; padding: 5px 10px; color: white; text-decoration: none; border-radius: 3px; font-size: 0.9em; border: none; cursor: pointer; text-align: center; }
.btn-edit { background-color: #ffc107; }
.btn-delete { background-color: #dc3545; }
.btn-action { background-color: #337ab7; }
.btn-small { padding: 4px 8px; font-size: 0.8em; }

/* --- LAYOUT SPECIFICI --- */
.page-actions { margin-top: 15px; margin-bottom: 20px; }
.login-container { display: flex; justify-content: center; align-items: center; padding: 50px 0; }
.login-form { width: 100%; max-width: 400px; padding: 30px; border: 1px solid #ddd; border-radius: 8px; background-color: #f9f9f9; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.login-form h2 { text-align: center; margin-bottom: 20px; }
.lettura-inputs { display: flex; flex-wrap: wrap; gap: 10px; }
.lettura-inputs input { flex-grow: 1; min-width: 120px; padding: 12px; font-size: 16px; }

/* --- MODALE / POPUP --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background-color: #fff; padding: 20px 30px; border-radius: 8px; width: 90%; max-width: 600px; position: relative; }
.modal-close { position: absolute; top: 10px; right: 15px; font-size: 28px; font-weight: bold; cursor: pointer; }
#popup-content ul { list-style: none; padding: 0; }
#popup-content li { padding: 8px 0; border-bottom: 1px solid #eee; }
.modal-actions { margin-top: 20px; text-align: right; }

/* --- FOOTER --- */
footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid #eee; color: #777; }
.footer-content { text-align: center; }
.dependency-note { color: #c82333; font-weight: bold; font-size: 0.9em; }


/* Stile per il riepilogo consumi comuni in dashboard */
.consumi-header {
    font-size: 1em;
    margin-top: 15px;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid #ddd;
}
.consumi-header:first-child {
    margin-top: 0;
}















/* --- REGOLE PER LA RESPONSIVITÀ SU SMARTPHONE --- */
@media (max-width: 768px) {
    .main-container { padding: 10px; }
    .form-row { flex-direction: column; gap: 0; }
    .lettura-inputs { flex-direction: column; }
    .stats-box { flex-direction: column; gap: 5px; }
    .stat-divider { display: none; }
    .stat-number { font-size: 2.2em; }
    .stat-label { font-size: 0.9em; }

    /* Stile per tabelle responsive "a scheda" */
    .table-box table, .table-box-widget table, 
    .table-box thead, .table-box-widget thead,
    .table-box tbody, .table-box-widget tbody,
    .table-box th, .table-box-widget th,
    .table-box td, .table-box-widget td,
    .table-box tr, .table-box-widget tr { display: block; }
    .table-box thead tr, .table-box-widget thead tr { position: absolute; top: -9999px; left: -9999px; }
    .table-box tr, .table-box-widget tr { border: 1px solid #ccc; border-radius: 5px; margin-bottom: 15px; overflow: hidden; }
    .table-box td, .table-box-widget td { border: none; border-bottom: 1px solid #eee; position: relative; padding-left: 50%; text-align: left; min-height: 24px; }
    .table-box td:before, .table-box-widget td:before { content: attr(data-label); position: absolute; left: 10px; width: 45%; padding-right: 10px; white-space: nowrap; text-align: left; font-weight: bold; }
    .table-box td:last-child, .table-box-widget td:last-child { border-bottom: 0; }

    /* Correzione per allineamento checkbox */
    .table-box td.text-center { display: flex; align-items: center; justify-content: flex-end; padding-left: 10px; }
    .table-box td.text-center:before { position: static; width: auto; margin-right: auto; }
    .table-box td.text-center input[type="checkbox"] { transform: scale(1.5); }
}

/* --- NUOVO HEADER CON MENU A TENDINA --- */
.main-header {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 70px;
    display: flex;
    align-items: center;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}
.header-logo {
    color: #333;
    text-decoration: none;
    font-size: 1.5em;
    font-weight: 600;
    display: flex;
    align-items: center;
}
.header-logo i { color: #007bff; margin-right: 10px; }
.main-nav { display: flex; align-items: center; gap: 5px; }
.nav-link {
    background: none;
    border: none;
    color: #555;
    text-decoration: none;
    font-size: 1em;
    padding: 10px 15px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.nav-link:hover { background-color: #f0f2f5; color: #007bff; }
.nav-item.dropdown { position: relative; }
.dropdown-toggle .dropdown-caret { font-size: 0.7em; transition: transform 0.2s ease; }
.dropdown:hover .dropdown-toggle .dropdown-caret { transform: rotate(180deg); }
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    list-style: none;
    padding: 10px 0;
    margin: 5px 0 0 0;
    min-width: 250px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item {
    display: block;
    padding: 10px 20px;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
}
.dropdown-item:hover { background-color: #f0f2f5; }
.logout-link { margin-left: 15px; }
.logout-link span { display: inline; }
.mobile-menu-toggle { display: none; }

/* Responsive per il nuovo menu */
@media (max-width: 1024px) {
    .main-nav {
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background-color: #fff;
        flex-direction: column;
        align-items: stretch;
        border-top: 1px solid #eee;
        box-shadow: 0 8px 16px rgba(0,0,0,0.1);
        display: none; /* Nascosto di default */
    }
    .main-nav.active { display: flex; }
    .nav-item.dropdown { display: block; width: 100%; }
    .dropdown-menu { position: static; box-shadow: none; border-top: 1px solid #eee; min-width: 100%; display: none; }
    .dropdown:hover .dropdown-menu, .dropdown.active .dropdown-menu { display: block; } /* Mostra su click/hover */
    .dropdown-toggle { width: 100%; justify-content: space-between; }
    .mobile-menu-toggle { display: block; background: none; border: none; font-size: 1.5em; cursor: pointer; }
    .logout-link span { display: none; } /* Nasconde la scritta logout */
}


/* Aggiungere alla fine del file /assets/css/style.css */

/* Spaziatura per i pulsanti di azione nelle tabelle */
.table-box td.text-center > .btn-edit,
.table-box td.text-center > .btn-delete,
.table-box td.text-center > .btn-action {
    margin: 0 4px; /* Aggiunge un piccolo margine orizzontale */
}

/* Stili per le opzioni dei report */
.report-options {
    display: block;
}

.form-group-radio {
    margin-bottom: 15px; /* Spazio tra le opzioni */
}

.form-group-radio label {
    display: flex; /* Allinea il pallino e il testo */
    align-items: center;
    cursor: pointer;
    font-weight: normal;
}

.form-group-radio input[type="radio"] {
    margin-right: 12px; /* Spazio tra il pallino e il testo */
    transform: scale(1.2); /* Rende il pallino leggermente più grande */
    flex-shrink: 0; /* Impedisce al radio button di rimpicciolirsi */
}