/* ============================================================
   GESTIONALE - Foglio di stile unico
   Usato da tutti i template: fatture e rapportini
   ============================================================ */

/* ------------------------------------------------------------
   Base
   ------------------------------------------------------------ */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background: white;
    margin: 0;
    padding: 0;
}

/* ------------------------------------------------------------
   Navbar
   ------------------------------------------------------------ */
.navbar {
    background: #334c64 !important;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
    display: flex;
    justify-content: flex-start !important;
}

.navbar-brand {
    font-size: 1rem;
    font-weight: bold;
    color: #fff !important;
    white-space: nowrap;
    margin-right: auto !important;
}

.navbar .btn-outline-light {
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
}

.navbar .btn-outline-danger {
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
}

/* Separatore visivo tra moduli nella navbar */
.navbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.2);
    margin: 0 4px;
    align-self: center;
}

/* Bottone modulo attivo nella navbar */
.navbar .btn-modulo-attivo {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-color: rgba(255,255,255,0.4);
}

/* ------------------------------------------------------------
   Contenitore principale
   ------------------------------------------------------------ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.container-fluid {
    padding: 1.5rem 1rem;
}

/* ------------------------------------------------------------
   Titoli pagina
   ------------------------------------------------------------ */
h4, .page-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 1rem;
}

/* ------------------------------------------------------------
   Tabelle
   ------------------------------------------------------------ */
.table {
    font-size: 0.88rem;
    background: #fff;
}

.table thead th {
    background: #90a428;
    color: #fff;
    font-weight: 600;
    padding: 8px 10px;
    border: none;
    white-space: nowrap;
}

.table thead th[onclick] {
    cursor: pointer;
    user-select: none;
}

.table thead th[onclick]:hover {
    background: #495057;
}

.table tbody tr:hover {
    background: #f0f4ff !important;
    cursor: pointer;
}

.table tbody td {
    padding: 7px 10px;
    vertical-align: middle;
    border-color: #e9ecef;
}

.table-striped tbody tr:nth-child(odd) td {
    background: #fafafa;
}

/* ------------------------------------------------------------
   Card
   ------------------------------------------------------------ */
.card {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.card-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #495057;
    border-radius: 6px 6px 0 0;
}

.card-body {
    padding: 1rem;
}

/* Card colorata per riepilogo/KPI */
.card-kpi {
    border-left: 4px solid #0d6efd;
    padding: 0.8rem 1rem;
}

.card-kpi.verde  { border-left-color: #198754; }
.card-kpi.rosso  { border-left-color: #dc3545; }
.card-kpi.arancio { border-left-color: #fd7e14; }
.card-kpi.grigio { border-left-color: #6c757d; }

.card-kpi .kpi-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-kpi .kpi-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: #212529;
}

/* ------------------------------------------------------------
   Modali
   ------------------------------------------------------------ */
.modal-header {
    background: #343a40;
    color: #fff;
    border-radius: 6px 6px 0 0;
    padding: 0.75rem 1rem;
}

.modal-header .btn-close {
    filter: invert(1);
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}

/* ------------------------------------------------------------
   Form e input
   ------------------------------------------------------------ */
.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 3px;
}

.form-control, .form-select {
    font-size: 0.88rem;
    padding: 0.35rem 0.6rem;
    border-color: #ced4da;
    border-radius: 4px;
}

.form-select {
    padding-right: 2rem;
}

.form-control:focus, .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.15);
}

/* Fix Edge - select anno navbar */
.selettori select,
#selAnno {
    padding-right: 1.8rem;
    min-width: 80px;
}

.form-control[readonly] {
    background: #f8f9fa;
    color: #6c757d;
}

/* Campo ore — larghezza fissa per orari */
.input-ora {
    max-width: 90px;
}

/* Campo numerico ore */
.input-ore {
    max-width: 80px;
    text-align: right;
}

/* ------------------------------------------------------------
   Badge tipo assenza / stato
   ------------------------------------------------------------ */
.badge-tipo {
    font-size: 0.72rem;
    padding: 3px 7px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-lavoro       { background: #d1ecf1; color: #0c5460; }
.badge-ferie        { background: #d4edda; color: #155724; }
.badge-festivo      { background: #fff3cd; color: #856404; }
.badge-malattia     { background: #f8d7da; color: #721c24; }
.badge-infortunio   { background: #f5c6cb; color: #721c24; }
.badge-scuola       { background: #e2e3e5; color: #383d41; }
.badge-ass-giust    { background: #d6d8ff; color: #2d2f8f; }
.badge-altra-ass    { background: #fde2e2; color: #8b1a1a; }
.badge-confermato   { background: #d4edda; color: #155724; }
.badge-bozza        { background: #fff3cd; color: #856404; }

/* ------------------------------------------------------------
   Bottoni
   ------------------------------------------------------------ */
.btn {
    font-size: 0.85rem;
    border-radius: 4px;
}

.btn-sm {
    font-size: 0.78rem;
    padding: 0.2rem 0.5rem;
}

/* ------------------------------------------------------------
   Alert
   ------------------------------------------------------------ */
.alert {
    font-size: 0.88rem;
    padding: 0.6rem 1rem;
    border-radius: 4px;
}

/* ------------------------------------------------------------
   Login
   ------------------------------------------------------------ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
}

.login-card {
    width: 100%;
    max-width: 380px;
}

/* ------------------------------------------------------------
   Home - scelta modulo
   ------------------------------------------------------------ */
.home-wrapper {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modulo-card {
    width: 220px;
    text-align: center;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 2rem 1rem;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    text-decoration: none;
    color: #333;
    display: block;
}

.modulo-card:hover {
    border-color: #0d6efd;
    box-shadow: 0 4px 16px rgba(13,110,253,0.12);
    transform: translateY(-3px);
    color: #0d6efd;
}

.modulo-card .modulo-icona {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    display: block;
}

.modulo-card .modulo-titolo {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.3rem;
}

.modulo-card .modulo-desc {
    font-size: 0.8rem;
    color: #6c757d;
}

/* ------------------------------------------------------------
   Riepilogo ore - tabella report CPC
   ------------------------------------------------------------ */
.tabella-report th {
    font-size: 0.75rem;
    text-align: center;
    white-space: nowrap;
}

.tabella-report td {
    font-size: 0.82rem;
    text-align: right;
    white-space: nowrap;
}

.tabella-report td:first-child {
    text-align: left;
    font-weight: 600;
}

.tabella-report tfoot td {
    font-weight: bold;
    border-top: 2px solid #343a40;
    background: #f8f9fa;
}

/* Cella differenza positiva/negativa */
.ore-positivo { color: #198754; font-weight: bold; }
.ore-negativo { color: #dc3545; font-weight: bold; }
.ore-zero     { color: #6c757d; }

/* ------------------------------------------------------------
   Calendario settimanale inserimento rapportini
   ------------------------------------------------------------ */
.riga-rapportino {
    border-left: 3px solid #dee2e6;
    margin-bottom: 4px;
    padding-left: 8px;
}

.riga-rapportino.festivo   { border-left-color: #ffc107; background: #fffdf0; }
.riga-rapportino.domenica  { border-left-color: #dc3545; background: #fff5f5; }
.riga-rapportino.assenza   { border-left-color: #6c757d; background: #f8f9fa; }
.riga-rapportino.confermato { border-left-color: #198754; }

/* ------------------------------------------------------------
   Stampa - report CPC
   ------------------------------------------------------------ */
@media print {
    .navbar, .no-print, .btn { display: none !important; }
    body { background: #fff; font-size: 11px; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    .container { padding: 0; max-width: 100%; }
    .tabella-report { page-break-inside: avoid; }
}
