/* ===================================================================
   Gestione Turni Web - Foglio di Stile Principale
   VERSIONE DEFINITIVA COMPLETA E CORRETTA
   =================================================================== */

/* --- Reset e Impostazioni Globali --- */
*, *::before, *::after {
    box-sizing: border-box;
}
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}
body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f9;
    color: #333;
    line-height: 1.65;
    font-size: 16px;
}

#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1050;
    transition: transform 0.4s ease-in-out;
    transform: translateY(100%);
    display: none;
    background-color: #2c3e50 !important;
    padding: 12px 0 !important;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
}

#cookie-banner.show {
    display: block;
    transform: translateY(0);
}

#cookie-banner .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    padding: 0 25px;
    margin: 0 auto;
    background-color: transparent;
    box-shadow: none;
}

#cookie-banner p, 
#cookie-banner a {
    color: #f8f9fa !important;
    margin: 0;
    font-size: 0.85rem;
}

#cookie-banner a {
    text-decoration: underline;
    font-weight: 600;
}

#cookie-banner #accept-cookie-btn {
    color: white !important;
    background-color: #007bff !important;
    border-color: #007bff !important;
    flex-shrink: 0;
}
/* --- Contenitore Principale --- */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 25px 30px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
}
.page-container {
    padding-top: 30px;
    padding-bottom: 30px;
}

/* --- Tipografia --- */
h1, h2, h3, h4, h5, h6 {
    margin-top: 1.6em;
    margin-bottom: 0.8em;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
    padding-bottom: 0;
    border-bottom: none;
}
h1 {
    margin-top: 0;
    font-weight: 700;
    font-size: 2.1em;
    padding-bottom: 10px;
    margin-bottom: 1.2em;
    border-bottom: 2px solid #007bff;
}
h2 { font-size: 1.7em; margin-top: 2.2em; }
h3 { font-size: 1.4em; }
h1 small {
    font-size: 0.5em;
    color: #777;
    font-weight: 400;
    display: block;
    margin-top: 6px;
}
p, ul, ol { margin-bottom: 1.3em; }
ul, ol { padding-left: 22px; }
pre {
    background-color: #f8f9fa; border: 1px solid #e0e0e0; padding: 15px;
    border-radius: 6px; white-space: pre-wrap; word-wrap: break-word;
    font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
    font-size: 0.9em; line-height: 1.7; color: #212529;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}
hr {
    margin: 2.5em 0; border: 0; height: 1px; background-color: #e0e0e0;
}

/* --- Link Standard --- */
a { color: #0069d9; text-decoration: none; transition: color 0.2s ease; }
a:hover, a:focus { color: #0056b3; text-decoration: none; }

/* --- Barra di Navigazione --- */
nav {
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 1030;
    border-bottom: 1px solid #e0e0e0;
}
nav .nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 25px;
    display: flex;
    align-items: center;
    min-height: 70px;
    justify-content: space-between;
    gap: 20px;
}
nav a.navbar-brand {
    color: #007bff;
    font-size: 1.8em;
    font-weight: 800;
    text-decoration: none;
    line-height: 1;
    padding: 10px 0;
    white-space: nowrap;
    transition: color 0.3s ease;
}
nav a.navbar-brand:hover {
    color: #0056b3;
}

/* Stili Desktop di Default per i Link */
.navbar-links {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    flex-grow: 1;
    justify-content: flex-start;
    position: static;
    width: auto;
    background-color: transparent;
    box-shadow: none;
    z-index: auto;
    border-top: none;
    padding: 0;
}

/* Stili comuni per i link della navbar (inclusi i toggle dei dropdown) */
.navbar-links > a,
.nav-item.dropdown .dropdown-toggle {
    color: #343a40;
    padding: 24px 15px;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: color 0.3s ease, border-bottom-color 0.3s ease, background-color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    margin-left: 10px;
    position: relative;
    min-width: fit-content;
}
.navbar-links > a:first-child {
    margin-left: 0;
}
.navbar-links > a:hover,
.nav-item.dropdown .dropdown-toggle:hover {
    color: #007bff;
    background-color: rgba(0, 123, 255, 0.05);
    border-bottom-color: #007bff;
}
.navbar-links > a.active,
.nav-item.dropdown .dropdown-toggle.active {
    color: #007bff;
    border-bottom-color: #007bff;
    font-weight: 600;
}

/* ----- Stili per la Navbar con Dropdown (specifico) ----- */
.nav-item.dropdown {
    position: relative;
}
.nav-item.dropdown .dropdown-toggle {
    cursor: pointer;
    padding-right: 30px;
}
.nav-item.dropdown .dropdown-toggle .dropdown-caret {
    margin-left: 8px;
    font-size: 0.7em;
    transition: transform 0.3s ease-in-out;
    color: #6c757d;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}
.nav-item.dropdown.open .dropdown-toggle .dropdown-caret {
    transform: translateY(-50%) rotate(180deg);
    color: #007bff;
}
.nav-item.dropdown .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 200px;
    padding: 0.5rem 0;
    margin: 0;
    font-size: 0.9em;
    color: #212529;
    text-align: left;
    list-style: none;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,.15);
    animation: fadeIn 0.2s ease-out;
    transform-origin: top;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.nav-item.dropdown.open .dropdown-menu {
    display: block;
}
.dropdown-menu a {
    display: flex;
    width: 100%;
    padding: 10px 18px;
    clear: both;
    font-weight: 400;
    color: #343a40;
    text-align: inherit;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    text-decoration: none;
    align-items: center;
    gap: 10px;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.dropdown-menu a:hover,
.dropdown-menu a:focus {
    color: #0056b3;
    background-color: #f0f4f7;
}
.dropdown-menu a.active {
    color: #007bff;
    background-color: #e6f2ff;
    font-weight: 600;
}
.dropdown-menu a i {
    width: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 0.95em;
}
.dropdown-menu a:hover i,
.dropdown-menu a.active i {
    color: #007bff;
}

/* Utente loggato / Azioni Login/Registrazione */
.navbar-user-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    padding: 0;
}
.navbar-user-greeting {
    color: #495057;
    font-weight: 500;
    padding: 0;
    white-space: nowrap;
}
.navbar-user-action {
    color: #007bff;
    background-color: transparent;
    border: 1px solid #007bff;
    border-radius: 20px;
    padding: 8px 18px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.navbar-user-action:hover {
    color: #ffffff;
    background-color: #007bff;
    border-color: #007bff;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.2);
}
.nav-admin-link {
    color: #dc3545 !important;
    border-bottom-color: transparent !important;
}
.nav-admin-link:hover {
    color: #c82333 !important;
    background-color: rgba(220, 53, 69, 0.05) !important;
    border-bottom-color: #c82333 !important;
}
.nav-admin-link.active {
    color: #dc3545 !important;
    border-bottom-color: #dc3545 !important;
}
.nav-admin-link i {
    color: #dc3545 !important;
}
.nav-admin-link:hover i,
.nav-admin-link.active i {
    color: #c82333 !important;
}

/* --- Navbar Toggler (Burger Button) --- */
.navbar-toggler {
    display: none;
    padding: .45rem .75rem;
    font-size: 1.4rem;
    line-height: 1;
    background-color: transparent;
    border: 1px solid #007bff;
    border-radius: .35rem;
    color: #007bff;
    cursor: pointer;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow .15s ease-in-out;
}
.navbar-toggler:hover {
    color: #ffffff;
    background-color: #007bff;
    border-color: #0069d9;
}
.navbar-toggler:focus {
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.5);
}
.navbar-toggler i {
    display: block;
    vertical-align: middle;
}


/* --- Bottoni --- */
.button {
    padding: 0.65em 1.3em; border: 1px solid transparent; border-radius: 6px;
    cursor: pointer; text-decoration: none; display: inline-flex;
    align-items: center; justify-content: center; gap: 8px;
    font-size: 0.95em; font-weight: 500; line-height: 1.5;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 3px rgba(0,0,0,0.08); margin: 0;
}
.button:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.12); }
.button:active { transform: translateY(0px); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.button.button-primary { background-color: #007bff; border-color: #007bff; color: white; }
.button.button-primary:hover { background-color: #0069d9; border-color: #0062cc;}
.button.button-secondary { background-color: #6c757d; border-color: #6c757d; color: white; }
.button.button-secondary:hover { background-color: #5a6268; border-color: #545b62;}
.button.button-danger { background-color: #dc3545; border-color: #dc3545; color: white; }
.button.button-danger:hover { background-color: #c82333; border-color: #bd2130;}
.button.button-export { background-color: #5a2aa8; border-color: #5a2aa8; color: white; }
.button.button-export:hover { background-color: #472186; border-color: #401e78;}
button[disabled], .button[disabled] {
    background-color: #adb5bd; border-color: #adb5bd; color: #e9ecef;
    cursor: not-allowed; opacity: 0.7; box-shadow: none; transform: none;
}
.button.button-small { padding: 0.45em 0.9em; font-size: 0.875em; gap: 6px; }

/* --- Form e Input --- */
.form-container { background-color: #ffffff; padding: 30px; border-radius: 8px; margin-top: 20px; }
.form-container fieldset { border: 1px solid #e0e0e0; padding: 20px 25px 25px 25px; margin-top: 1.5em; margin-bottom: 2.5em; border-radius: 6px; }
.form-container legend { font-size: 1.2em; font-weight: 600; color: #007bff; padding-bottom: 8px; margin-bottom: 20px; border-bottom: 1px solid #e9ecef; width: auto; display: inline-block; margin-left: 0; }
label { font-weight: 500; color: #495057; margin-bottom: 0.5rem; font-size: 0.9rem; display: block; }
input[type="text"], input[type="password"], input[type="date"].flatpickr-input,
input[type="time"],
select, textarea {
    padding: 0.7rem 1rem; border: 1px solid #d1d5db; border-radius: 6px;
    width: 100%; font-size: 0.95rem; background-color: #f9fafb; color: #374151;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    max-width: 480px;
}
input[type="date"], input[type="time"] { max-width: 220px; background-color: #f9fafb; }
select { background-color: #fff; }
textarea { min-height: 90px; resize: vertical; }
input[type="text"]:focus, input[type="password"]:focus, input[type="date"]:focus,
input[type="time"]:focus,
select:focus, textarea:focus, input.flatpickr-input:focus {
    border-color: #007bff; outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.2);
    background-color: #fff;
}
.form-error { color: #e53e3e; font-size: 0.8rem; margin-top: 0.3rem; display: block; }
div.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 30px; padding-top: 25px; border-top: 1px solid #e0e0e0; }
div.form-actions .delete-button-form-inline { margin: 0; }
div.form-actions > .button, div.form-actions > button, div.form-actions > a.button,
div.form-actions > form > .button, div.form-actions > form > button { margin: 0 !important; }
.datepicker-container { position: relative; display: inline-block; vertical-align: middle; }
.datepicker-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #6c757d; pointer-events: none; z-index: 1; }
input.datepicker-trigger {
    padding: 10px 15px 10px 38px; font-size: 0.95em; font-weight: 500; color: #495057;
    background-color: #e9ecef; border: 1px solid #ced4da; border-radius: 5px;
    cursor: pointer; vertical-align: middle; max-width: 220px; width: auto;
}
input.datepicker-trigger:hover { background-color: #dee2e6; border-color: #adb5bd; }
.filter-form { display: flex; align-items: flex-end; gap: 15px; flex-wrap: wrap; padding: 10px 0; }
.filter-item { display: flex; flex-direction: column; }
.filter-form label { font-size: 0.85em; font-weight: 600; color: #495057; margin-bottom: 4px; }
.filter-form select { padding: 8px 12px; padding-right: 2.5rem; font-size: 0.9em; max-width: 230px; width: auto; border-radius: 5px; border: 1px solid #ced4da; background-color: #fff; }

/* --- Viste Lista (OSS, Pazienti, Turni Giorno) --- */
.list-page-actions { margin-bottom: 1.5rem; text-align: right; }
table:not(.weekly-grid) {
    width: 100%; border-collapse: collapse; border: 1px solid #e0e0e0; font-size: 0.95em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); border-radius: 6px; overflow: hidden;
    margin-top: 1.5em; margin-bottom: 2em;
}
table:not(.weekly-grid) th, table:not(.weekly-grid) td { padding: 12px 15px; text-align: left; vertical-align: middle; border-bottom: 1px solid #e9ecef; }
table:not(.weekly-grid) tr:last-child td { border-bottom: none; }
table:not(.weekly-grid) thead th {
    background-color: #f8f9fa; color: #343a40; font-weight: 600;
    font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.05em;
    border-bottom-width: 2px; border-bottom-color: #dee2e6;
}
table:not(.weekly-grid) tbody tr:hover { background-color: #f1f3f5; }
table:not(.weekly-grid) td { color: #555; }
table.responsive-table thead tr th:last-child { text-align: center; }
table.responsive-table tbody tr td.actions-cell { text-align: right; white-space: nowrap; }
table.responsive-table td.actions-cell .button { margin-left: 6px; }
table.responsive-table td.actions-cell .button:first-child { margin-left: 0; }

/* --- Messaggi di notifica (Alerts) - BLOCCO UNIFICATO --- */
.flash-messages-container {
    padding: 0 1rem;
    margin-bottom: 1rem;
}
.alert {
    padding: 15px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.alert .close-alert {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
    opacity: 0.7;
    cursor: pointer;
    padding: 0 0 0 1rem;
    text-shadow: none;
}
.alert .close-alert:hover {
    opacity: 1;
}
/* Colori degli alert */
.alert-danger {
    background-color: #dc3545;
    border-color: #d32535;
    color: #fff;
}
.alert-success {
    background-color: #28a745;
    border-color: #23923d;
    color: #fff;
}
.alert-warning {
    background-color: #ffc107;
    border-color: #e0a800;
    color: #212529; /* Testo scuro per leggibilità su sfondo giallo */
}
.alert-info {
    background-color: #17a2b8;
    border-color: #1591a5;
    color: #fff;
}
/* Stili per le liste dentro gli alert (es. avviso conflitti) */
.alert ul {
    padding-left: 20px;
    margin: 10px 0 0 0;
    text-align: left;
    flex-basis: 100%; /* La lista occupa tutta la larghezza */
}
.alert li {
    line-height: 1.4;
    margin-bottom: 0.4rem;
}

.temporary-notification {
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}
.temporary-notification.fade:not(.show) {
    opacity: 0;
}

/* --- Stili Specifici Griglia Settimanale (Desktop) --- */
/* Stili Corretti */
.weekly-grid-scroll-container {
    overflow-x: auto;
    overflow-y: auto;  /* <-- AGGIUNTO: Abilita lo scorrimento verticale */
    max-height: 75vh;  /* <-- AGGIUNTO: Imposta un'altezza massima (75% dell'altezza dello schermo) */
    width: 100%; 
    max-width: 100%; 
    margin-bottom: 25px;
    border: 1px solid #ced4da; 
    border-radius: 6px; 
    background-color: #fff;
}
table.weekly-grid {
    table-layout: auto; width: 100%;
    border-collapse: collapse; border-spacing: 0; margin: 0; font-size: 0.9em;
}
table.weekly-grid th, table.weekly-grid td {
    border: 1px solid #dee2e6; padding: 8px 10px;
    vertical-align: top; text-align: left;
}
table.weekly-grid thead th {
    background-color: #f8f9fa; color: #343a40; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.8em;
    text-align: center; vertical-align: middle; white-space: nowrap;
    position: sticky; top: 0; z-index: 2;
}
table.weekly-grid thead th:not(:nth-child(1)):not(:nth-child(2)) { min-width: 135px; }
table.weekly-grid tbody td { background-color: #ffffff; line-height: 1.4; min-height: 50px; }
table.weekly-grid tbody tr:hover td { background-color: #f9f9f9; }
table.weekly-grid th:first-child, table.weekly-grid td:first-child {
    width: 80px; min-width: 80px; position: sticky; left: 0; z-index: 3;
    text-align: center; border-right: 1px solid #adb5bd;
}
table.weekly-grid th:nth-child(2), table.weekly-grid td:nth-child(2) {
    width: 95px; min-width: 95px; position: sticky; left: 80px;
    z-index: 3; text-align: center; border-right: 1px solid #adb5bd;
}
table.weekly-grid thead th:first-child, table.weekly-grid thead th:nth-child(2) {
     background-color: #f0f2f5 !important; z-index: 4;
}
table.weekly-grid tbody td:first-child, table.weekly-grid tbody td:nth-child(2) {
     background-color: #fdfdff !important;
}
.weekly-grid .turno-item {
    display: block; margin-bottom: 5px; padding: 6px 8px; border-radius: 4px;
    border: 1px solid #d0d9e3;
    border-left-width: 5px;
    position: relative;
    line-height: 1.3;
    font-size: 0.82em;
    word-break: break-word;
    transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.weekly-grid .turno-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.weekly-grid .turno-item:last-child { margin-bottom: 0; }
.weekly-grid .turno-item strong {
    display: block; margin-bottom: 2px;
    font-weight: 600; font-size: 1.05em;
    color: #222;
    display: flex;
    align-items: center;
    line-height: 1.2;
}
.weekly-grid .turno-item strong i.fa-fw {
    margin-right: 6px;
    font-size: 0.9em;
    opacity: 0.9;
}
.weekly-grid .turno-item small {
    display: block; font-size: 0.9em; color: #454545;
    margin-top: 3px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}
.weekly-grid .turno-item small .turno-type-label {
    font-weight: 700;
}
.weekly-grid .turno-item small .turno-additional-details {
    margin-left: 5px;
    color: #555;
}
.weekly-grid .turno-item small .turno-additional-details:empty + .nota-info-icon {
     margin-left: 5px;
}
.weekly-grid .turno-item small .turno-type-label + .turno-additional-details + .nota-info-icon,
.weekly-grid .turno-item small .turno-type-label:not(:empty) + .nota-info-icon:not(:first-child) {
    margin-left: 8px;
}
.weekly-grid .turno-item.mattina    { border-left-color: #FFB300; background-color: #FFF8E1; }
.weekly-grid .turno-item.mattina strong i.fa-sun { color: #FFA000; }
.weekly-grid .turno-item.pomeriggio { border-left-color: #F57C00; background-color: #FFF3E0; }
.weekly-grid .turno-item.pomeriggio strong i.fa-cloud-sun { color: #EF6C00; }
.weekly-grid .turno-item.notte      { border-left-color: #5E35B1; background-color: #EDE7F6; }
.weekly-grid .turno-item.notte strong i.fa-moon { color: #4527A0; }
.weekly-grid .turno-item.prestazione{ border-left-color: #00897B; background-color: #E0F2F1; }
.weekly-grid .turno-item.prestazione strong i.fa-briefcase-medical { color: #00695C; }
.weekly-grid .turno-item.turno_8h   { border-left-color: #546E7A; background-color: #ECEFF1; }
.weekly-grid .turno-item.turno_8h strong i.fa-clock { color: #37474F; }
.weekly-grid a.turno-item-link, .weekly-grid a.turno-item-link:hover {
    text-decoration: none; color: inherit; display: block;
}

/* Inserire queste nuove regole alla fine del file, o dopo gli stili di .weekly-grid */
.weekly-grid .turno-item.personal-view {
    /* Aggiunge un po' di padding per compensare la rimozione del nome OSS */
    padding: 10px 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.weekly-grid .turno-item.personal-view small {
    /* Ingrandisce il font size del contenitore <small> */
    font-size: 1.1em;
    font-weight: 500;
    line-height: 1.4;
}

.weekly-grid .turno-item.personal-view .turno-type-label {
    /* Rende il tipo di turno (es. Mattina) in grassetto */
    font-weight: 600;
}

.weekly-grid .turno-item.personal-view .turno-additional-details {
    /* Rende l'orario leggermente più evidente */
    font-weight: 500;
    margin-left: 8px; /* Aggiunge spazio tra tipo turno e orario */
}

/* --- Viste Card Mobile (Generali e Specifiche) --- */
.mobile-view, .mobile-card-container { display: none; }
.desktop-view, .desktop-grid-container { display: block; }

.entity-card {
    background-color: #ffffff; border: 1px solid #e7eaec; border-radius: 8px;
    margin-bottom: 20px; box-shadow: 0 3px 8px rgba(0,0,0,0.07);
}
.entity-card .card-header {
    background-color: #f9fafb; padding: 12px 15px; font-weight: 600;
    border-bottom: 1px solid #e7eaec; font-size: 1.1em; color: #333;
}
.entity-card .card-body { padding: 15px; font-size: 0.95em; }
.entity-card .card-body p { margin-bottom: 0.7em; line-height: 1.5; }
.entity-card .card-body p strong { color: #495057; margin-right: 5px; }
.entity-card .card-footer.actions-card-footer {
    background-color: #fdfdfe; padding: 15px; border-top: 1px solid #e7eaec;
    display: flex; flex-direction: column; gap: 10px;
}
.actions-card-footer .actions-label {
    font-weight: 600; color: #333; font-size: 0.95em; margin-bottom: 8px;
}
.actions-card-footer .button-block,
.actions-card-footer .button-block-form > button {
    display: block; width: 100%; text-align: center; margin: 0; box-sizing: border-box;
}
.actions-card-footer .button-block-form { display: block; width: 100%; margin: 0; }

.day-card {
    background-color: #ffffff; border: 1px solid #e0e0e0; border-radius: 8px;
    margin-bottom: 20px; box-shadow: 0 3px 8px rgba(0,0,0,0.07); overflow: hidden;
}
.day-card-header {
    /* Proprietà Flexbox aggiunte */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px; /* Aggiunge uno spazio tra gli elementi */

    /* Stili esistenti (invariati) */
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    font-weight: 600;
    border-bottom: 1px solid #0056b3;
    font-size: 1.1em;
}
.day-card-body { padding: 15px; }
.operator-block { margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px dashed #e0e0e0; }
.operator-block:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.operator-name { font-weight: 600; color: #2c3e50; margin-bottom: 8px; font-size: 1.05em; }
.operator-name i { margin-right: 6px; color: #6c757d; }
.mobile-turno-link, .mobile-turno-link:hover { text-decoration: none; color: inherit; }

.mobile-turno-item {
    background-color: #f8f9fa; border: 1px solid #e9ecef; padding: 8px 12px;
    margin-bottom: 6px; border-radius: 4px; border-left-width: 4px;
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 5px;
}
.mobile-turno-item:last-child { margin-bottom: 0; }

/* CORREZIONE CONFLITTO: Aumentata specificità per garantire l'applicazione dei colori */
.mobile-turno-item.mattina { border-left-color: #FFB300 !important; background-color: #FFF8E1 !important;}
.mobile-turno-item.pomeriggio { border-left-color: #F57C00 !important; background-color: #FFF3E0 !important;}
.mobile-turno-item.notte { border-left-color: #5E35B1 !important; background-color: #EDE7F6 !important;}
.mobile-turno-item.prestazione { border-left-color: #00897B !important; background-color: #E0F2F1 !important;}
.mobile-turno-item.turno_8h { border-left-color: #546E7A !important; background-color: #ECEFF1 !important;}

.mobile-turno-paziente {
    font-weight: 500; font-size: 0.95em;
    display: flex;
    align-items: center;
}
.mobile-turno-paziente i.fa-fw {
    margin-right: 5px; opacity: 0.9; font-size: 0.9em;
}
.mobile-turno-dettagli {
    font-size: 0.85em; color: #555; text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.mobile-turno-dettagli .turno-type-label {
    font-weight: 700;
}
.mobile-turno-dettagli .turno-additional-details {
    font-size: 0.95em;
    color: #666;
}

/* Stile per le card Mobile */
.mobile-turno-item.personal-view {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 8px;
}

.mobile-turno-item.personal-view .mobile-turno-dettagli {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 1.1em;
    font-weight: 600;
}

.mobile-turno-item.personal-view .turno-additional-details {
    font-weight: 500;
    margin-left: 8px;
}

.mobile-turno-item.personal-view .nota-info-icon {
    margin-top: 5px;
    padding: 2px 6px;
    background-color: rgba(0,0,0,0.05);
    border-radius: 4px;
}


/* Stato OSS */
.status-disponibile { color: #198754; font-weight: 500; }
.status-disponibile i { margin-right: 5px; }
.status-indisponibile { color: #dc3545; font-weight: 500; }
.status-indisponibile i { margin-right: 5px; }

/* Dashboard */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin: 30px 0 40px 0;
}
.stat-card {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}
.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}
.stat-icon {
    font-size: 3.5em;
    margin-bottom: 15px;
    color: #007bff;
}
.stat-card:nth-child(1) .stat-icon { color: #007bff; }
.stat-card:nth-child(2) .stat-icon { color: #28a745; }
.stat-card:nth-child(3) .stat-icon { color: #ffc107; }
.stat-value {
    font-size: 3.8em;
    font-weight: 800;
    color: #343a40;
    margin-bottom: 8px;
    line-height: 1;
}
.stat-label {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 20px;
    font-weight: 600;
}
.stat-link {
    font-size: 0.95em;
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
    padding: 10px 20px;
    border: 2px solid #007bff;
    border-radius: 25px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 123, 255, 0.2);
}
.stat-link:hover {
    background-color: #007bff;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0, 123, 255, 0.3);
}
.quick-actions-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.quick-actions-container .button {
    flex-grow: 1;
    text-align: center;
    padding: 12px 15px;
    font-size: 1em;
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

/* Footer */
footer { margin-top: 3.5em; padding-top: 2em; border-top: 1px solid #e0e0e0; text-align: center; font-size: 0.9em; color: #777; }
footer a { color: #555; text-decoration: underline; }
footer hr {
    border: 0;
    height: 1px;
    background-color: #e0e0e0;
    margin-top: 0;
    margin-bottom: 1.5em;
}

/* Stili per cella vuota cliccabile e link "Aggiungi Altro Turno" */
.empty-cell-add-turno { display: flex; align-items: center; justify-content: center; min-height: 40px; color: #007bff; cursor: pointer; border-radius: 3px; transition: background-color 0.2s ease, color 0.2s ease; }
.empty-cell-add-turno:hover { background-color: #e9f5ff; color: #0056b3; }
.empty-cell-add-turno i.fa-plus { font-size: 1.2em; }
a.add-turno-from-grid-link, a.add-turno-from-grid-link:hover { text-decoration: none; display: block; }
.cella-turni-container { position: relative; }
.add-another-turno-from-grid-link { display: block; text-align: center; padding: 5px 0; margin-top: 8px; text-decoration: none; color: #007bff; border-radius: 4px; transition: background-color 0.2s ease; }
.add-another-turno-from-grid-link:hover { background-color: #e9f5ff; color: #0056b3; }
.add-turno-icon-container { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 0.85em; }
.add-turno-icon-container i.fa-plus-circle { font-size: 1.1em; }
.cella-turni-container:empty + .add-another-turno-from-grid-link,
.cella-turni-container > .add-another-turno-from-grid-link:only-child { margin-top: 0; }

/* --- Stili per Icona Info Note --- */
.nota-info-icon {
    cursor: pointer;
    color: #007bff;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
    margin-left: 8px;
    vertical-align: middle;
}
.nota-info-icon:hover,
.nota-info-icon:focus {
    color: #0056b3;
    background-color: #e9f5ff;
    text-decoration: none;
}
.nota-info-icon i {
    font-size: 1em;
}
.nota-visualizza-testo {
    font-size: 0.85em;
    font-weight: 500;
}

/* Stile per rendere un <button> simile a un link */
button.button-link-style {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    font: inherit !important;
    color: #007bff !important;
    cursor: pointer !important;
    text-align: left !important;
    display: inline-flex;
    align-items: center;
}
button.button-link-style:hover,
button.button-link-style:focus {
    color: #0056b3 !important;
    text-decoration: underline !important;
    background-color: transparent !important;
}
button.button-link-style:focus {
    outline: 1px dotted #0056b3;
    outline-offset: 1px;
}

/* --- Stili per la Modale delle Note --- */
.custom-modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    padding-top: 60px;
}
.custom-modal .modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 25px 30px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    animation-name: animatetop;
    animation-duration: 0.4s
}
@keyframes animatetop {
    from {top: -300px; opacity: 0}
    to {top: 0; opacity: 1}
}
.modal-close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
}
.modal-close-button:hover,
.modal-close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}
.modal-content h4 {
    margin-top: 0;
    color: #007bff;
    font-size: 1.5em;
    margin-bottom: 15px;
}
.modal-content hr {
    margin-top: 0;
    margin-bottom: 20px;
}
.modal-note-text {
    font-size: 1em;
    line-height: 1.7;
    color: #333;
    max-height: 60vh;
    overflow-y: auto;
    word-wrap: break-word;
}
.modal-note-text p {
    margin-bottom: 0.8em;
}
.modal-note-text br {
    display: block;
    margin-bottom: 0.5em;
    content: "";
}

/* Contenitore per le card, si adatta al numero di colonne definito nell'HTML */
.card-grid-container {
    display: grid;
    gap: 20px; /* Spazio tra le card */
}

/* Stile base per ogni card di un turno */
.turno-card {
    background-color: #ffffff;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.turno-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.turno-card-header {
    background-color: #f8f9fa;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e0e6ed;
}
.turno-card-header h3 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: #34495e;
}
.turno-card-header span {
    font-size: 0.9em;
    color: #6c757d;
}

.turno-card-body {
    padding: 1rem;
    flex-grow: 1;
    text-align: center;
}
.turno-card-body span {
    display: block;
}

.turno-card-footer {
    background-color: #f8f9fa;
    padding: 0.75rem 1rem;
    border-top: 1px solid #e0e6ed;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

/* Barre colorate laterali per tipo di turno */
.turno-card.mattina { border-left: 5px solid #ffc107; }
.turno-card.pomeriggio { border-left: 5px solid #fd7e14; }
.turno-card.notte { border-left: 5px solid #6610f2; }
.turno-card.prestazione { border-left: 5px solid #20c997; }

.turno-card .personal-view-giorno .turno-type-label {
    font-weight: 600;
}

/* Stile per la griglia desktop */
.weekly-grid .turno-item.h24 { 
    border-left-color: #0d6efd; /* Esempio: un blu primario */
    background-color: #cfe2ff; 
}
.weekly-grid .turno-item.h24 strong i.fa-infinity { 
    color: #0a58ca; 
}

/* Stile per le card mobile */
.mobile-turno-item.h24 { 
    border-left-color: #0d6efd !important; 
    background-color: #cfe2ff !important;
}

/* ============================================= */
/* Stili per Pagina Fascicolo Operatore (v3)     */
/* ============================================= */
.fascicolo-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}
.fascicolo-header h1 {
    border-bottom: none;
    padding-bottom: 0;
}
.fascicolo-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 2rem;
    align-items: flex-start;
}
.profile-card {
    flex: 0 0 340px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 2rem;
    text-align: center;
}
.profile-avatar {
    font-size: 5rem;
    color: #007bff;
    margin-bottom: 1rem;
    line-height: 1;
}
.profile-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}
.profile-role {
    font-size: 1rem;
    color: #6c757d;
    margin-top: 0.25rem;
    margin-bottom: 1.5rem;
}
.profile-details {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    text-align: left;
}
.profile-details li {
    display: flex;
    align-items: baseline; 
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.profile-details li:last-child { border-bottom: none; }
.profile-details i {
    color: #007bff;
    margin-right: 1rem;
    width: 20px;
    text-align: center;
}
.profile-details strong {
    margin-left: auto;
    color: #343a40;
    word-break: break-all;
}
.button-block {
    display: block;
    width: 100%;
}
.documents-panel {
    flex: 1 1 auto;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden; 
}
.tabs-navigation {
    display: flex;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}
.tab-link {
    padding: 1rem 1.5rem;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1rem;
    font-weight: 500;
    color: #495057;
    border-bottom: 3px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.tab-link:hover { color: #007bff; }
.tab-link.active {
    color: #007bff;
    border-bottom-color: #007bff;
}
.tabs-content { padding: 2rem; }
.tab-pane { display: none; }
.tab-pane.active {
    display: block;
    animation: fadeIn 0.5s;
}

.document-table {
    width: 100%;
    border-collapse: collapse;
}
.document-table th, .document-table td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e9ecef;
}
.document-table thead th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}
.document-table tbody tr:hover { background-color: #f8f9fa; }
.document-table td.actions-cell { text-align: right; }

/* =================================== */
/* --- Media Queries per Responsività --- */
/* =================================== */
@media (max-width: 1024px) {
    .navbar-toggler {
        display: block;
        cursor: pointer;
        border: 1px solid #007bff;
        color: #007bff;
        background: transparent;
        padding: 0.25rem 0.6rem;
        font-size: 1.2rem;
        border-radius: .3rem;
    }
    .nav-container {
        padding: 0 15px;
    }
    .navbar-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 70px; 
        left: 0;
        width: 100%;
        background-color: #343a40;
        padding: 0;
        border-top: 1px solid #495057;
        overflow-x: hidden;       
    }
    .navbar-links.is-active {
        display: flex;
    }
    .navbar-links .nav-item {
        display: flex;
        flex-direction: column;
        width: 100%;
        border-bottom: 1px solid #495057;
        box-sizing: border-box;
    }
    .nav-item > a {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 14px 25px;
        text-decoration: none;
        color: #f8f9fa !important;
        border-left: 3px solid transparent;
        box-sizing: border-box;
        transition: background-color 0.2s ease, border-left-color 0.2s ease;
    }
    .nav-link-content {
        display: flex;
        align-items: center;
        flex-direction: row; 
        gap: 8px;
    }
    .nav-item > a .dropdown-caret {
        margin-left: auto;
        padding-left: 10px;
    }
    .nav-item > a:hover,
    .nav-item.dropdown.open > a {
        background-color: rgba(255,255,255,0.08);
        border-left-color: #007bff;
    }
    .nav-item.dropdown .dropdown-menu {
        display: none;
        position: static;
        width: 100%;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background-color: rgba(0,0,0,0.2);
        margin: 0;
        padding: 0;
        animation: none;
    }
    .nav-item.dropdown.open .dropdown-menu {
        display: block;
    }
    .dropdown-menu a {
        padding: 10px 25px 10px 45px !important;
        border-bottom: 1px solid #555;
        color: #adb5bd !important;
    }
    .dropdown-menu a:last-child {
        border-bottom: none;
    }
    .navbar-user-section {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
        padding-top: 10px;
        margin-top: 10px;
        border-top: 1px solid #6c757d;
    }
     .navbar-user-section .nav-item {
        border-bottom: none;
    }
    .navbar-user-action {
        border-radius: 0 !important;
        border-bottom: none !important;
        background: none !important;
        box-shadow: none !important;
    }
     hr.navbar-mobile-divider {
        display: none;
    }
}

@media screen and (max-width: 992px) {
    /* Stili responsivi per la pagina Fascicolo/Cartella */
    .fascicolo-container {
        flex-direction: column;
        gap: 1.5rem; /* Aggiunge spazio tra i due blocchi */
    }
    .profile-card,
    .documents-panel {
        /* Forza entrambi i blocchi a prendere tutta la larghezza disponibile */
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    #tab-sospensioni .row {
        flex-direction: column;
        gap: 1rem;
    }

    #tab-sospensioni .row .col-md-2,
    #tab-sospensioni .row .col-md-3,
    #tab-sospensioni .row .col-md-4 {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
    /* Rende la tabella dei documenti una lista di card */
    .document-table {
        border: none;
    }
    .document-table thead {
        display: none;
    }
    .document-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    .document-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1rem;
        text-align: right;
        border-bottom: 1px solid #e9ecef;
        gap: 1rem;
    }
    .document-table td:last-child {
        border-bottom: none;
    }
    .document-table td::before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        color: #495057;
        flex-shrink: 0;
    }
    .document-table td.actions-cell {
        justify-content: center;
    }
    .document-table td a {
        overflow-wrap: break-word;
        word-wrap: break-word;
        word-break: break-word;
        min-width: 0;
    }
}
@media (max-width: 768px) {
    nav a.navbar-brand {
        font-size: 1.5em;
        font-weight: 700;
    }
   
    .container {
        padding: 20px 15px;
        margin-left: 10px;
        margin-right: 10px;
        width: auto;
    }
    h1 {
        font-size: 1.8em;
    }
    .desktop-view, .desktop-grid-container {
        display: none !important;
    }
    .mobile-view, .mobile-card-container {
        display: block !important;
    }
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .form-actions .button, .form-actions .button-block-form .button {
        width: 100%;
        margin-left: 0;
    }
    table.responsive-table thead {
        display: none;
    }
    table.responsive-table tr {
        display: block;
        margin-bottom: 1.5em;
        border: 1px solid #ddd;
        border-radius: 6px;
    }
    table.responsive-table td {
        display: block;
        text-align: left;
        border-bottom: 1px dotted #eee;
        padding: 12px 15px;
        position: relative;
    }
    table.responsive-table td:last-child {
        border-bottom: 0;
    }
    table.responsive-table td::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        font-size: 0.8em;
        text-transform: uppercase;
        color: #6c757d;
        margin-bottom: 6px;
    }
    table.responsive-table td.actions-cell {
        text-align: center;
        white-space: normal;
        padding-top: 15px;
        padding-bottom: 15px;
        padding-left: 15px;
    }
    table.responsive-table td.actions-cell::before {
        display: block;
        position: relative;
        left: 0;
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
        font-weight: 600;
        color: #333;
    }
    .actions-cell .button,
    .actions-cell form {
        display: inline-block;
        width: auto;
        margin: 4px !important;
    }
    .actions-cell .button + .button,
    .actions-cell .button + form,
    .actions-cell form + form {
        margin-top: 10px;
    }
   .responsive-table {
        border: none;
        width: 100%;
    }

    /* Nasconde l'intestazione della tabella su mobile */
    .responsive-table thead {
        display: none;
    }

    .responsive-table tr {
        /* Ogni riga diventa una "card" separata */
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        overflow: hidden; /* Assicura che gli angoli arrotondati vengano rispettati */
    }

    .responsive-table td {
        display: flex; /* Usa flexbox per un allineamento migliore */
        justify-content: space-between; /* Spinge l'etichetta a sinistra e il valore a destra */
        align-items: center;
        text-align: right; /* Allinea il testo del valore a destra */
        padding: 12px 15px; /* Aumenta un po' lo spazio interno */
        border-bottom: 1px solid #e9ecef;
        position: relative;
    }

    .responsive-table td:last-child {
        border-bottom: none;
    }

    /* Crea l'etichetta usando il contenuto dell'attributo data-label */
    .responsive-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #495057;
        text-align: left;
        margin-right: 1rem; /* Aggiunge spazio tra etichetta e valore */
    }

    /* Stile specifico per la cella delle azioni */
    .responsive-table td.actions-cell {
        justify-content: center; /* Centra il pulsante */
    }

    .responsive-table td.actions-cell::before {
        display: none; /* Non mostrare l'etichetta "Azioni" */
    }
}

@media (max-width: 480px) {
    body {
        font-size: 15px;
    }
    .container {
        width: 100%;
        margin: 15px 0;
        padding: 20px 15px;
        border-radius: 0;
        box-shadow: none;
        border-bottom: 1px solid #e0e0e0;
    }
    h1 { font-size: 1.6em; margin-bottom: 0.8em; }
    h2 { font-size: 1.4em; }
    h3 { font-size: 1.2em; }
    .button {
        padding: 0.7em 1.1em;
        font-size: 0.9em;
    }
    .quick-actions-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .dashboard-stats-grid {
        gap: 15px;
        margin-top: 20px;
        margin-bottom: 30px;
    }
    .stat-card {
        padding: 20px;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 20px;
    }
    .stat-icon {
        font-size: 2.5em;
        margin-bottom: 0;
    }
    .stat-value {
        font-size: 2.2em;
        line-height: 1;
        margin-bottom: 2px;
    }
    .stat-label {
        font-size: 0.9em;
        margin-bottom: 0;
    }
    .stat-card > div:not(.stat-icon) {
        text-align: left;
    }
    .stat-link {
        display: none;
    }
    .form-container {
        padding: 20px 15px;
    }
    .form-container fieldset {
        padding: 15px;
    }
    table.responsive-table thead { 
        border: none; 
        clip: rect(0 0 0 0); 
        height: 1px; 
        margin: -1px; 
        overflow: hidden; 
        padding: 0; 
        position: absolute; 
        width: 1px; 
    }
    table.responsive-table tr { 
        display: block; 
        margin-bottom: 1.5em; 
        border: 1px solid #ddd; 
        border-radius: 6px; 
        box-shadow: 0 1px 3px rgba(0,0,0,0.05); 
    }
    table.responsive-table tr:last-child { margin-bottom: 0; }
     table.responsive-table td { 
        display: block; 
        text-align: left;
        font-size: 0.9em; 
        border-bottom: 1px dotted #eee; 
        padding: 12px 15px;
        position: relative; 
        white-space: normal; 
        word-wrap: break-word; 
    }
    table.responsive-table td:last-child {
        background-color: #f8f9fa;
        padding: 12px 15px;
        text-align: center;
        border-bottom: 0;
    }
    table.responsive-table td::before { 
        content: attr(data-label); 
        display: block;
        white-space: normal;
        text-align: left; 
        font-weight: 600; 
        color: #333;
        font-size: 0.8em;
        text-transform: uppercase;
        margin-bottom: 6px;
    }
}
#notification-area {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1050;
    width: 350px;
    max-width: 90%;
}

.toast-custom {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-bottom: 1rem;
    opacity: 0;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
    transform: translateX(110%);
    overflow: hidden;
}

.toast-custom.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-header-custom {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.toast-header-custom .fa-bell {
    margin-right: 0.75rem;
    color: #495057;
}

.toast-header-custom strong {
    margin-right: auto;
    font-weight: 600;
    color: #212529;
}

.toast-close-button {
    border: none;
    background: transparent;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: 0.5;
    cursor: pointer;
    padding: 0;
    margin-left: 1rem;
}

.toast-close-button:hover {
    opacity: 0.8;
}

.toast-body-custom {
    padding: 1rem;
    color: #212529;
}

.toast-link-wrapper {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input[type="password"],
.password-input-wrapper input[type="text"] {
    padding-right: 40px;
    width: 100%;
}

.password-toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #6c757d;
    padding: 5px;
    z-index: 2;
}

.password-toggle-btn:hover {
    color: #343a40;
}

.report-card-mobile {
    background-color: #ffffff;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 1rem;
    border-left-width: 5px;
    overflow: hidden;
}

.report-card-mobile .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.95em;
    border-bottom: 1px solid #e9ecef;
}

.report-card-mobile .card-body {
    padding: 1.2rem 1rem;
    text-align: center;
}

.report-card-mobile .paziente-info {
    font-size: 1.15em;
    font-weight: 500;
    margin-bottom: 0.6rem;
    color: #2c3e50;
}

.report-card-mobile .orario-info {
    color: #6c757d;
    font-size: 1em;
}

.report-card-mobile .paziente-info i,
.report-card-mobile .orario-info i {
    margin-right: 8px;
    color: #8899a6;
}

.report-card-mobile.mattina    { border-left-color: #ffc107; }
.report-card-mobile.pomeriggio { border-left-color: #fd7e14; }
.report-card-mobile.notte      { border-left-color: #6610f2; }
.report-card-mobile.prestazione{ border-left-color: #20c997; }
.report-card-mobile.turno_8h   { border-left-color: #546E7A; }

.monthly-calendar-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.monthly-calendar-grid thead th {
    background-color: #f8f9fa;
    color: #343a40;
    font-weight: 600;
    text-align: center;
    padding: 10px 5px;
    border: 1px solid #dee2e6;
}

.monthly-calendar-grid td.calendar-day,
.monthly-calendar-grid td.calendar-day-empty {
    height: 120px;
    border: 1px solid #dee2e6;
    vertical-align: top;
    padding: 5px;
}

.monthly-calendar-grid td.calendar-day-empty {
    background-color: #f9fafb;
}

.monthly-calendar-grid .day-number {
    font-weight: 600;
    color: #495057;
    text-align: right;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.monthly-calendar-grid .day-content {
    overflow-y: auto;
    max-height: 85px;
}

.monthly-calendar-grid .turno-item {
    padding: 4px 6px;
    margin-bottom: 4px;
    font-size: 0.8em;
}
.monthly-calendar-grid .turno-item strong {
    font-size: 1.05em;
}
.monthly-calendar-grid .turno-item small {
    margin-top: 2px;
}

.day-summary-link {
    display: block;
    margin-top: 5px;
    padding: 10px 5px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    font-size: 1em;
    transition: background-color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.day-summary-link:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.day-summary-link .count {
    font-size: 1.3em;
    display: block;
    line-height: 1;
}

.day-summary-link .label {
    font-size: 0.8em;
    display: block;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-calendar-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.day-event-card {
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.06);
}

.day-event-card:hover {
    background-color: #f8f9fa;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.day-event-date {
    flex-shrink: 0;
    text-align: center;
    margin-right: 1.25rem;
    padding-right: 1.25rem;
    border-right: 2px solid #007bff;
}

.day-event-date .day-num {
    font-size: 2.2em;
    font-weight: 700;
    color: #007bff;
    line-height: 1;
}

.day-event-date .day-name {
    font-size: 0.9em;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: 600;
}

.day-event-summary {
    flex-grow: 1;
}

.day-event-summary .summary-text {
    font-size: 1.1em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.2rem;
}

.day-event-summary .summary-details {
    font-size: 0.9em;
    color: #555;
    line-height: 1.4;
}

.day-event-arrow {
    margin-left: auto;
    font-size: 1.5em;
    color: #adb5bd;
    padding-left: 1rem;
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.operator-badge {
    display: block;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
    color: #212529;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.operator-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: #000;
}

/* --- Stili Avviso Conflitto Indisponibilità --- */
.conflict-alert {
    flex-direction: column; /* Imposta gli elementi in colonna */
    align-items: flex-start; /* Allinea a sinistra */
    padding: 1rem 1.25rem;
}

.conflict-alert-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.15rem;
    font-weight: 600;
    width: 100%;
    margin-bottom: 0.75rem;
}

.conflict-alert-header .fa-triangle-exclamation {
    font-size: 1.3rem;
}

.conflict-alert-summary {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem !important; /* Forza il margine */
    width: 100%;
    color: #fff; /* Assicura che il testo sia bianco */
}

.conflict-alert-summary strong {
    color: #fff; /* Assicura che anche il testo in grassetto sia bianco */
    text-decoration: underline;
}

.conflict-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    background-color: rgba(0,0,0,0.1);
    border-radius: 6px;
    max-height: 180px; /* Altezza massima con scroll */
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.2);
}

.conflict-list li {
    display: flex;
    flex-wrap: wrap; /* Permette al testo di andare a capo su mobile */
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    font-size: 0.9em;
}

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

.conflict-date {
    font-weight: 600;
    margin-right: 1rem;
    white-space: nowrap;
}

.conflict-details {
    text-align: right;
    flex-grow: 1; /* Occupa lo spazio rimanente */
}

.conflict-details strong {
    color: #fff;
}

.turno-item .turno-checkbox {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5; /* La mettiamo sopra il contenuto */
    transform: scale(1.3); /* La ingrandiamo un po' per renderla più cliccabile */
}

/* 3. Aggiungi spazio a destra al link per non andare sotto la checkbox */
.weekly-grid .turno-item .turno-item-link {
    display: block; /* Assicura che il link occupi lo spazio */
    padding-right: 30px; /* Aggiunge uno spazio a destra per la checkbox */
}

.weekly-grid .turno-item strong .oss-name {
    /* Imposta queste proprietà per un "a capo" più intelligente */
    overflow-wrap: break-word;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
    
    /* Impedisce che l'icona e il testo vengano schiacciati in modo strano */
    flex-shrink: 1;
    min-width: 0; /* Permette al flex-item di restringersi correttamente */
}

.weekly-grid thead th a {
    color: inherit; /* Eredita il colore nero dell'intestazione */
    text-decoration: none;
    display: block;
    padding: 8px 5px;
    transition: color 0.2s ease;
}

.weekly-grid thead th a:hover {
    color: #007bff; /* Evidenzia il link al passaggio del mouse */
    text-decoration: underline;
}

/* ================================================================ */
/* === INIZIO BLOCCO DI CORREZIONE PER LA GRIGLIA DI PIANIFICAZIONE === */
/* ================================================================ */

/* Stile generico per la tabella di pianificazione */
.planning-table {
    table-layout: fixed; /* Impedisce alle colonne di ridimensionarsi in base al contenuto */
    width: 100%;
}

.planning-table td {
    vertical-align: middle; /* Centra verticalmente il contenuto della cella */
    min-width: 150px;       /* Dà a ogni cella una larghezza minima per respirare */
    padding: 0.5rem !important; /* Aggiunge un po' di spazio interno */
}

/* Contenitore flessibile per gli elementi dentro ogni cella */
.planning-cell-content {
    display: flex;
    flex-direction: column;   /* Dispone gli elementi in colonna (uno sopra l'altro) */
    align-items: stretch;     /* Allunga gli elementi per occupare tutta la larghezza */
    justify-content: center;
    gap: 0.4rem;              /* Aggiunge un piccolo spazio tra il menu e i campi orario */
    height: 100%;
}

/* Stili specifici per i campi del form dentro la griglia */
.planning-cell-content .form-select,
.planning-cell-content .form-control {
    width: 100%; /* Assicura che riempiano il contenitore */
    font-size: 0.85rem; /* Rende il testo leggermente più piccolo per adattarsi meglio */
}

/* Stili per il contenitore dei due campi orario */
.time-input-group {
    display: flex;
    gap: 0.25rem; /* Spazio tra i due campi ora */
}

/* Stili per l'indicatore "sta scrivendo" del Bot */
.message.bot.typing {
    background-color: #f1f1f1;
    align-self: flex-start;
    color: #888;
    font-style: italic;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #999;
    margin: 0 2px;
    animation: typing-pulse 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing-pulse {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1.0);
    }
}

/* Stili per i pulsanti di suggerimento del Chatbot */
.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 10px;
}

.suggestion-btn {
    background-color: #e7f3ff;
    border: 1px solid #cce0f5;
    color: #0056b3;
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.suggestion-btn:hover {
    background-color: #d0e7ff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
