/**
 * Healthcare EHR/EMR System Styles
 * Professional Medical Interface for Prestazione Sanitaria
 */

:root {
    --primary-color: #2c5aa0;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --medical-blue: #2980b9;
    --medical-green: #27ae60;
    --medical-red: #e74c3c;
    --medical-orange: #f39c12;
    --medical-orange-rgb: 243, 156, 18;
    --medical-purple: #9b59b6;
    --border-radius: 8px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

/* Global Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: var(--light-color);
    color: #333;
    /* Add padding for fixed navbar and footer */
    padding-top: 75px;
    padding-bottom: 60px;
}

/* Remove padding for login page */
body.login-page {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Professional Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--dark-color);
}

.text-primary {
    color: var(--primary-color) !important;
}

/* Center navbar items */
.navbar-collapse {
    justify-content: center !important;
}

.navbar-nav.me-auto {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

/* Force dropdown menus to appear directly below their buttons */
.navbar .dropdown {
    position: relative !important;
}

.navbar .dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    margin-top: 0.125rem !important;
}

/* Specific positioning for Staff dropdown - FORCE CENTER */
.nav-item.dropdown:has(#staffDropdown) .dropdown-menu {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    min-width: 180px !important;
}

/* Specific positioning for Account dropdown */
.nav-item.dropdown:has(#navbarDropdown) .dropdown-menu {
    left: auto !important;
    right: 0 !important;
    transform: none !important;
    min-width: 200px !important;
}

/* Override Bootstrap's dropdown-menu-start class */
.dropdown-menu-start {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
}

/* Force Personale dropdown to center - AGGRESSIVE FIX */
#staffDropdownContainer {
    position: relative !important;
}

#staffDropdownContainer .dropdown-menu,
#staffDropdown + .dropdown-menu,
#staffDropdown ~ .dropdown-menu {
    position: absolute !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    min-width: 180px !important;
    top: 100% !important;
    margin-top: 0.125rem !important;
}

/* Override ALL Bootstrap dropdown positioning for Personale */
#staffDropdownContainer .dropdown-menu.show {
    position: absolute !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    inset: unset !important;
}

/* Navbar Custom Button Styles */
.navbar-nav .nav-link {
    font-weight: 500;
    border-radius: 8px;
    margin: 0 2px;
    padding: 8px 16px !important;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dashboard Dropdown Menu - Full Width */
.dropdown-menu-departments {
    position: fixed !important;
    width: 98% !important;
    left: 1% !important;
    right: 1% !important;
    top: 70px !important;
    transform: none !important;
    border: 2px solid rgba(44, 90, 160, 0.2);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    border-radius: 15px;
    padding: 20px 30px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    overflow-x: hidden;
    background: white;
    z-index: 9999;
    display: none !important;
    box-sizing: border-box;
}

/* Override Bootstrap completely */
.dropdown-menu-departments.show {
    display: block !important;
}

/* Remove Bootstrap's positioning */
.navbar .dropdown {
    position: static !important;
}

/* Dashboard Header Main */
.dropdown-header-main {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.dropdown-item-main {
    display: inline-block;
    padding: 15px 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--medical-blue));
    color: white !important;
    font-weight: 700;
    font-size: 16px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(44, 90, 160, 0.3);
}

.dropdown-item-main:hover {
    background: linear-gradient(135deg, var(--medical-blue), var(--primary-color));
    transform: scale(1.08);
    color: white !important;
    box-shadow: 0 6px 20px rgba(44, 90, 160, 0.4);
}

/* Departments Grid Layout - Full Width Horizontal Organization */
.departments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    padding: 20px 0;
    width: 100%;
    justify-content: center;
}

/* Department dropdown items styling */
.dropdown-menu-departments .dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: white;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    color: #333 !important;
    text-decoration: none;
    min-height: 45px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-menu-departments .dropdown-item:hover {
    color: #000 !important;
    font-weight: 700;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-color: #333;
}

.dropdown-menu-departments .dropdown-item.active {
    color: #000 !important;
    font-weight: 700;
    border-color: #333;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.dropdown-menu-departments .dropdown-item i {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    font-size: 14px;
    flex-shrink: 0;
}

/* Colori unici per ogni reparto */
/* Pronto Soccorso - Rosso */
.dropdown-item[href*="prontosoccorso"] {
    background: linear-gradient(135deg, #ff6b6b, #ff5252) !important;
}

/* Cardiologia - Rosa/Rosso */
.dropdown-item[href*="cardiologia"] {
    background: linear-gradient(135deg, #ff9999, #ff6666) !important;
}

/* Chirurgia - Verde chirurgico */
.dropdown-item[href*="chirurgia"] {
    background: linear-gradient(135deg, #4ecca3, #26a69a) !important;
}

/* Pediatria - Azzurro baby */
.dropdown-item[href*="pediatria"] {
    background: linear-gradient(135deg, #87ceeb, #6bb6d6) !important;
}

/* Ortopedia - Grigio/Blu */
.dropdown-item[href*="ortopedia"] {
    background: linear-gradient(135deg, #7f8c8d, #607d8b) !important;
}

/* Ginecologia - Rosa */
.dropdown-item[href*="ginecologia"] {
    background: linear-gradient(135deg, #ff9ff3, #ee5a91) !important;
}

/* Neurologia - Viola */
.dropdown-item[href*="neurologia"] {
    background: linear-gradient(135deg, #9b59b6, #8e44ad) !important;
}

/* Medicina Interna - Blu navy */
.dropdown-item[href*="medicina"] {
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
}

/* Radiologia - Grigio scuro */
.dropdown-item[href*="radiologia"] {
    background: linear-gradient(135deg, #636e72, #2d3436) !important;
}

/* Allergologia - Verde menta */
.dropdown-item[href*="allergologia"] {
    background: linear-gradient(135deg, #a8e6cf, #7fcdbb) !important;
}

/* Anatomia Patologica - Marrone */
.dropdown-item[href*="anatomiapatologica"] {
    background: linear-gradient(135deg, #a8726a, #8b5a3c) !important;
}

/* Anestesia e Rianimazione - Blu elettrico */
.dropdown-item[href*="anestesiarianimazione"] {
    background: linear-gradient(135deg, #00b4d8, #0077b6) !important;
}

/* Angiologia - Rosso vino */
.dropdown-item[href*="angiologia"] {
    background: linear-gradient(135deg, #c9302c, #ac2925) !important;
}

/* Audiologia - Arancione */
.dropdown-item[href*="audiologia"] {
    background: linear-gradient(135deg, #ff9f43, #ee5a24) !important;
}

/* Cardiochirurgia - Rosso scuro */
.dropdown-item[href*="cardiochirurgia"] {
    background: linear-gradient(135deg, #d63031, #c0392b) !important;
}

/* Chirurgia Maxillo-Facciale - Verde acqua */
.dropdown-item[href*="chirurgiamaxillofacciale"] {
    background: linear-gradient(135deg, #48dbfb, #0abde3) !important;
}

/* Chirurgia Plastica - Rosa pesca */
.dropdown-item[href*="chirurgiaplastica"] {
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e) !important;
}

/* Chirurgia Toracica - Verde bosco */
.dropdown-item[href*="chirurgiatoracica"] {
    background: linear-gradient(135deg, #27ae60, #229954) !important;
}

/* Chirurgia Vascolare - Rosso bordeaux */
.dropdown-item[href*="chirurgiavascolare"] {
    background: linear-gradient(135deg, #e17055, #d63031) !important;
}

/* Dermatologia - Rosa salmone */
.dropdown-item[href*="dermatologia"] {
    background: linear-gradient(135deg, #fab1a0, #ff7675) !important;
}

/* Ematologia - Rosso sangue */
.dropdown-item[href*="ematologia"] {
    background: linear-gradient(135deg, #ff4757, #ee5a6f) !important;
}

/* Endocrinologia - Verde lime */
.dropdown-item[href*="endocrinologia"] {
    background: linear-gradient(135deg, #badc58, #6ab04c) !important;
}

/* Gastroenterologia - Giallo oro */
.dropdown-item[href*="gastroenterologia"] {
    background: linear-gradient(135deg, #f9ca24, #f0932b) !important;
}

/* Genetica Medica - Viola chiaro */
.dropdown-item[href*="geneticamedica"] {
    background: linear-gradient(135deg, #dfe6e9, #b2bec3) !important;
}

/* Geriatria - Marrone chiaro */
.dropdown-item[href*="geriatria"] {
    background: linear-gradient(135deg, #cd6133, #a0522d) !important;
}

/* Immunologia - Verde acqua */
.dropdown-item[href*="immunologia"] {
    background: linear-gradient(135deg, #55efc4, #00b894) !important;
}

/* Infettivologia - Giallo limone */
.dropdown-item[href*="infettivologia"] {
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e) !important;
}

/* Medicina del Lavoro - Grigio blu */
.dropdown-item[href*="medicinadellavoro"] {
    background: linear-gradient(135deg, #74b9ff, #0984e3) !important;
}

/* Medicina dello Sport - Verde prato */
.dropdown-item[href*="medicinadellosport"] {
    background: linear-gradient(135deg, #55a3ff, #5f27cd) !important;
}

/* Medicina d'Emergenza-Urgenza - Rosso fuoco */
.dropdown-item[href*="medicinaemergenzaurgenza"] {
    background: linear-gradient(135deg, #ff3838, #ff0000) !important;
}

/* Medicina Fisica e Riabilitazione - Azzurro */
.dropdown-item[href*="medicinafisicariabilitazione"] {
    background: linear-gradient(135deg, #54a0ff, #2e86de) !important;
}

/* Medicina Generale - Blu classico */
.dropdown-item[href*="medicinagenerale"] {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
}

/* Medicina Legale - Nero/Grigio */
.dropdown-item[href*="medicinalegale"] {
    background: linear-gradient(135deg, #636e72, #2d3436) !important;
}

/* Medicina Nucleare - Verde neon */
.dropdown-item[href*="medicinanulceare"] {
    background: linear-gradient(135deg, #20bf6b, #26de81) !important;
}

/* Nefrologia - Blu oceano */
.dropdown-item[href*="nefrologia"] {
    background: linear-gradient(135deg, #3c6382, #2c2c54) !important;
}

/* Neonatologia - Rosa baby */
.dropdown-item[href*="neonatologia"] {
    background: linear-gradient(135deg, #ffcccc, #ffb3ba) !important;
}

/* Neurochirurgia - Viola scuro */
.dropdown-item[href*="neurochirurgia"] {
    background: linear-gradient(135deg, #6c5ce7, #5f3dc4) !important;
}

/* Neuropsichiatria Infantile - Azzurro chiaro */
.dropdown-item[href*="neuropsichiatriainfantile"] {
    background: linear-gradient(135deg, #a29bfe, #6c5ce7) !important;
}

/* Oculistica - Azzurro brillante */
.dropdown-item[href*="oculistica"] {
    background: linear-gradient(135deg, #00d2d3, #01a3a4) !important;
}

/* Odontoiatria - Bianco perla */
.dropdown-item[href*="odontoiatria"] {
    background: linear-gradient(135deg, #ecf0f1, #bdc3c7) !important;
}

/* Oncologia - Arancione scuro */
.dropdown-item[href*="oncologia"] {
    background: linear-gradient(135deg, #e67e22, #d35400) !important;
}

/* Otorinolaringoiatria - Verde oliva */
.dropdown-item[href*="otorinolaringoiatria"] {
    background: linear-gradient(135deg, #82ccdd, #60a3bc) !important;
}

/* Pneumologia - Azzurro cielo */
.dropdown-item[href*="pneumologia"] {
    background: linear-gradient(135deg, #78e08f, #38ada9) !important;
}

/* Psichiatria - Viola lavanda */
.dropdown-item[href*="psichiatria"] {
    background: linear-gradient(135deg, #c56cf0, #cd84f1) !important;
}

/* Radioterapia - Giallo sole */
.dropdown-item[href*="radioterapia"] {
    background: linear-gradient(135deg, #fff200, #ffc312) !important;
}

/* Reumatologia - Verde smeraldo */
.dropdown-item[href*="reumatologia"] {
    background: linear-gradient(135deg, #0be881, #05c46b) !important;
}

/* Urologia - Blu cobalto */
.dropdown-item[href*="urologia"] {
    background: linear-gradient(135deg, #575fcf, #3c40c6) !important;
}

/* Responsive grid for extra large screens */
@media (min-width: 1600px) {
    .departments-grid {
        grid-template-columns: repeat(6, minmax(160px, 1fr));
    }
}

/* Responsive grid for large screens */
@media (min-width: 1400px) and (max-width: 1599px) {
    .departments-grid {
        grid-template-columns: repeat(5, minmax(180px, 1fr));
    }
}

/* Responsive grid for medium-large screens */
@media (max-width: 1399px) and (min-width: 1200px) {
    .departments-grid {
        grid-template-columns: repeat(4, minmax(200px, 1fr));
    }
}

/* Responsive grid for tablets */
@media (max-width: 1199px) and (min-width: 992px) {
    .departments-grid {
        grid-template-columns: repeat(4, minmax(180px, 1fr));
    }
}

@media (max-width: 991px) and (min-width: 768px) {
    .departments-grid {
        grid-template-columns: repeat(3, minmax(180px, 1fr));
    }
}

/* Responsive grid for mobile */
@media (max-width: 768px) {
    .dropdown-menu-departments {
        width: calc(100% - 20px) !important;
        left: 10px !important;
        right: 10px !important;
        padding: 20px;
    }
    
    .departments-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}

@media (max-width: 576px) {
    .departments-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* Dashboard Dropdown Menu Alignment */
.dropdown-menu[aria-labelledby="dashboardDropdown"] {
    min-width: 220px;
    padding: 8px 0;
    border-radius: 12px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.12);
    border: none;
}

.dropdown-menu[aria-labelledby="dashboardDropdown"] .dropdown-item {
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    border-radius: 6px;
    margin: 2px 8px;
}

.dropdown-menu[aria-labelledby="dashboardDropdown"] .dropdown-item i {
    width: 20px;
    text-align: center;
    margin-right: 12px;
    font-size: 1rem;
    opacity: 0.8;
}

.dropdown-menu[aria-labelledby="dashboardDropdown"] .dropdown-item:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: var(--primary-color);
    transform: translateX(2px);
}

.dropdown-menu[aria-labelledby="dashboardDropdown"] .dropdown-item:hover i {
    opacity: 1;
    color: var(--primary-color);
}

.dropdown-menu[aria-labelledby="dashboardDropdown"] .dropdown-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e4a8c 100%);
    color: white;
}

.dropdown-menu[aria-labelledby="dashboardDropdown"] .dropdown-item.active i {
    color: white;
    opacity: 1;
}

.dropdown-menu[aria-labelledby="dashboardDropdown"] .dropdown-divider {
    margin: 8px 12px;
    border-color: #e9ecef;
}

/* Miglioramenti per tutti i dropdown del sistema */
.dropdown-menu {
    border-radius: 10px;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 6px 0;
}

.dropdown-menu .dropdown-item {
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 6px;
    margin: 1px 6px;
}

.dropdown-menu .dropdown-item i {
    width: 18px;
    text-align: center;
    margin-right: 10px;
    opacity: 0.8;
}

.dropdown-menu .dropdown-item:hover i {
    opacity: 1;
}

/* Stili specifici per le icone dei reparti */
.dropdown-item i.fa-ambulance { color: #dc3545; }
.dropdown-item i.fa-heartbeat { color: #e74c3c; }
.dropdown-item i.fa-user-md { color: #3498db; }
.dropdown-item i.fa-child { color: #f39c12; }
.dropdown-item i.fa-bone { color: #95a5a6; }
.dropdown-item i.fa-female { color: #e91e63; }
.dropdown-item i.fa-brain { color: #9b59b6; }
.dropdown-item i.fa-stethoscope { color: #27ae60; }
.dropdown-item i.fa-x-ray { color: #34495e; }

/* Quando l'elemento è in hover, mantieni il colore originale dell'icona */
.dropdown-item:hover i.fa-ambulance { color: #dc3545; }
.dropdown-item:hover i.fa-heartbeat { color: #e74c3c; }
.dropdown-item:hover i.fa-user-md { color: #3498db; }
.dropdown-item:hover i.fa-child { color: #f39c12; }
.dropdown-item:hover i.fa-bone { color: #95a5a6; }
.dropdown-item:hover i.fa-female { color: #e91e63; }
.dropdown-item:hover i.fa-brain { color: #9b59b6; }
.dropdown-item:hover i.fa-stethoscope { color: #27ae60; }
.dropdown-item:hover i.fa-x-ray { color: #34495e; }

/* Dashboard Button - Blue */
.nav-dashboard {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white !important;
}

.nav-dashboard:hover {
    background: linear-gradient(45deg, #2980b9, #3498db);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.nav-dashboard.active {
    background: linear-gradient(45deg, #2471a3, #1f5f8b);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.5);
}

/* Dashboard Dropdown Styles */
#dashboardDropdown::after {
    color: white;
}

.navbar-nav .dropdown-menu {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 10px;
}

/* Fix dropdown position for Personale menu to appear directly below button */
#staffDropdown + .dropdown-menu {
    left: 0 !important;
    right: auto !important;
    transform: none !important;
    position: absolute !important;
}

.navbar-nav .dropdown-item {
    border-radius: 8px;
    padding: 10px 15px;
    transition: all 0.3s ease;
    margin: 2px 0;
}

.navbar-nav .dropdown-item:hover {
    background-color: #f0f2f5;
    transform: translateX(5px);
}

/* Pronto Soccorso Special Style in Dropdown */
.dropdown-item-pronto {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%) !important;
    color: #d9534f !important;
    border: 1px solid #ffdddd;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.dropdown-item-pronto:hover {
    background: linear-gradient(135deg, #ffe0e0 0%, #ffcccc 100%) !important;
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(217, 83, 79, 0.2);
}

.dropdown-item-pronto i {
    color: #d9534f !important;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Mobile Navbar Fixes */
@media (max-width: 991.98px) {
    /* Style the navbar toggler */
    .navbar-toggler {
        border: 2px solid rgba(255, 255, 255, 0.3);
        padding: 4px 12px;
        border-radius: 8px;
        margin-left: auto;
    }
    
    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25);
    }
    
    .navbar-toggler-icon {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    }
    
    /* Mobile navbar container */
    .navbar-collapse {
        background-color: white;
        margin-top: 0.5rem;
        padding: 1rem;
        border-radius: 12px;
        box-shadow: 0 5px 20px rgba(0,0,0,0.1);
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }
    
    /* Fix navbar navigation styles */
    .navbar-nav {
        padding: 0.5rem 0;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem !important;
        margin: 0.25rem 0 !important;
        border-radius: 8px;
        font-weight: 500;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    /* Dashboard button specific styling */
    .nav-dashboard {
        background: linear-gradient(45deg, #3498db, #2980b9) !important;
        color: white !important;
    }
    
    /* Fix navbar dropdowns on mobile */
    .navbar-nav .dropdown {
        position: relative !important;
    }
    
    .navbar-nav .dropdown-menu {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        width: 100%;
        margin: 0.5rem 0 !important;
        padding: 0.5rem;
        background-color: #f8f9fa;
        border: 1px solid rgba(0,0,0,.1);
        border-radius: 8px;
        box-shadow: inset 0 2px 5px rgba(0,0,0,0.05) !important;
        transform: none !important;
        transition: none !important;
        display: none;
        z-index: 1050 !important;
        max-height: 400px;
        overflow-y: auto;
    }
    
    /* Fix departments dropdown specifically on mobile */
    .navbar-nav .dropdown-menu-departments {
        position: absolute !important;
        top: calc(100% + 5px) !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: calc(100vh - 200px) !important;
        overflow-y: auto !important;
    }
    
    .navbar-nav .dropdown-menu-departments .departments-grid {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    /* Ensure dropdown menu shows when .show class is added */
    .navbar-nav .dropdown-menu.show {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    /* Fix dropdown toggle to be clickable on mobile */
    .navbar-nav .dropdown-toggle {
        pointer-events: auto !important;
        cursor: pointer !important;
    }
    
    /* Style dropdown items */
    .navbar-nav .dropdown-menu .dropdown-item {
        display: block;
        width: calc(100% - 1rem);
        margin: 0.25rem 0.5rem;
        padding: 0.6rem 1rem;
        border-radius: 6px;
        background-color: white;
        color: #333;
        font-weight: 400;
        text-align: left;
        white-space: nowrap;
        border: 1px solid rgba(0,0,0,0.05);
        transition: all 0.2s ease;
    }
    
    .navbar-nav .dropdown-menu .dropdown-item:hover {
        background-color: var(--primary-color);
        color: white;
        transform: translateX(5px);
    }
    
    /* Center dropdown dividers */
    .navbar-nav .dropdown-menu .dropdown-divider {
        margin: 0.5rem auto;
        width: 90%;
        opacity: 0.3;
    }
    
    /* Ensure dropdown toggle is clickable */
    .navbar-nav .dropdown-toggle {
        cursor: pointer;
        position: relative;
    }
    
    /* Style active dropdown items */
    .navbar-nav .dropdown-menu .dropdown-item.active,
    .navbar-nav .dropdown-menu .dropdown-item:active {
        background-color: var(--primary-color);
        color: white;
    }
    
    /* Position dropdown arrow correctly */
    .navbar-nav .dropdown-toggle::after {
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        transition: transform 0.3s;
    }
    
    .navbar-nav .dropdown-toggle[aria-expanded="true"]::after {
        transform: translateY(-50%) rotate(180deg);
    }
    
    /* Style dropdown items on mobile */
    .navbar-nav .dropdown-item {
        padding: 0.75rem 1.5rem;
        border-radius: 0;
    }
    
    /* Fix nav button styles on mobile */
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem !important;
        margin: 0.25rem 0 !important;
        border-radius: 8px;
        text-align: left !important;
    }
    
    /* Ensure dropdowns are clickable on touch devices */
    .dropdown-toggle {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* Special style for Pronto Soccorso in mobile dropdown */
    .dropdown-item-pronto {
        margin: 0.25rem 0.5rem !important;
        border-radius: 6px !important;
    }
    
    /* Fix navbar collapse background */
    .navbar-collapse {
        background-color: white;
        padding: 1rem;
        margin-top: 1rem;
        border-radius: 8px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    }
    
    /* Remove desktop-only elements on mobile */
    .d-none.d-lg-flex {
        display: none !important;
    }
}

/* Pazienti Button - Green */
.nav-pazienti {
    background: linear-gradient(45deg, #27ae60, #229954);
    color: white !important;
}

.nav-pazienti:hover {
    background: linear-gradient(45deg, #229954, #27ae60);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.4);
}

.nav-pazienti.active {
    background: linear-gradient(45deg, #1e8449, #196f3d);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.5);
}

/* Reparti Button - Purple */
.nav-reparti {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    color: white !important;
}

.nav-reparti:hover {
    background: linear-gradient(45deg, #8e44ad, #9b59b6);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(155, 89, 182, 0.4);
}

.nav-reparti.active {
    background: linear-gradient(45deg, #7d3c98, #6c3483);
    box-shadow: 0 5px 15px rgba(155, 89, 182, 0.5);
}

/* Personale Button - Orange */
.nav-personale {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white !important;
}

.nav-personale:hover {
    background: linear-gradient(45deg, #e67e22, #f39c12);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4);
}

.nav-personale.active {
    background: linear-gradient(45deg, #d35400, #ba4a00);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.5);
}

/* Dropdown fixes for navbar */
.navbar .dropdown-toggle::after {
    margin-left: 0.5rem;
}

.navbar .nav-item.dropdown .nav-link {
    cursor: pointer;
}

/* Mobile user icons styling */
.mobile-user-icons {
    gap: 0.25rem;
    margin-right: 0.5rem;
}

.mobile-user-icons .icon-circle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    position: relative;
}

.mobile-user-icons .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
}

.mobile-user-icons .notification-badge {
    font-size: 0.6rem;
    padding: 0.15rem 0.3rem;
}

/* Ensure mobile icons are properly aligned */
@media (max-width: 991.98px) {
    .navbar-brand {
        margin-right: auto;
    }
    
    /* Hide mobile user icons in navbar top on mobile */
    .mobile-user-icons {
        display: none !important;
    }
    
    /* Style the mobile icons section in collapsed menu */
    .mobile-icons-section .icon-circle {
        width: 45px;
        height: 45px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        position: relative;
    }
    
    .mobile-icons-section .chat-icon {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
    }
    
    .mobile-icons-section .notification-icon {
        background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
        color: white;
    }
    
    .mobile-icons-section .logout-icon {
        background: linear-gradient(135deg, #dc3545, #c82333);
        color: white;
    }
    
    .mobile-icons-section .notification-badge {
        position: absolute;
        top: -5px;
        right: -5px;
        background: #ff4444;
        color: white;
        border-radius: 50%;
        width: 18px;
        height: 18px;
        font-size: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
    }
    
    .mobile-icons-section .user-avatar {
        width: 45px;
        height: 45px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        font-weight: bold;
        font-size: 1.2rem;
    }
    
    .mobile-icons-section .user-avatar-img {
        width: 45px;
        height: 45px;
        border-radius: 50%;
        object-fit: cover;
    }
}

/* Archivio Button - Teal */
.nav-archivio {
    background: linear-gradient(45deg, #00bcd4, #0097a7);
    color: white !important;
}

.nav-archivio:hover {
    background: linear-gradient(45deg, #0097a7, #00bcd4);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 188, 212, 0.4);
}

.nav-archivio.active {
    background: linear-gradient(45deg, #00838f, #006064);
    box-shadow: 0 5px 15px rgba(0, 188, 212, 0.5);
}

/* Magazzino Button - Yellow */
.nav-magazzino {
    background: linear-gradient(45deg, #FED800, #E5C200);
    color: #333 !important;
}

.nav-magazzino:hover {
    background: linear-gradient(45deg, #E5C200, #FED800);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(254, 216, 0, 0.4);
}

.nav-magazzino.active {
    background: linear-gradient(45deg, #CCB000, #B39900);
    box-shadow: 0 5px 15px rgba(254, 216, 0, 0.5);
}

/* Amministrazione Button - Indigo */
.nav-amministrazione {
    background: linear-gradient(45deg, #3f51b5, #303f9f);
    color: white !important;
}

.nav-amministrazione:hover {
    background: linear-gradient(45deg, #303f9f, #3f51b5);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(63, 81, 181, 0.4);
}

.nav-amministrazione.active {
    background: linear-gradient(45deg, #283593, #1a237e);
    box-shadow: 0 5px 15px rgba(63, 81, 181, 0.5);
}

/* Impostazioni Button - Red */
.nav-impostazioni {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white !important;
}

.nav-impostazioni:hover {
    background: linear-gradient(45deg, #c0392b, #e74c3c);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.nav-impostazioni.active {
    background: linear-gradient(45deg, #a93226, #922b21);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.5);
}

/* Desktop navbar icons spacing */
.navbar-nav.d-none.d-lg-flex {
    gap: 0.25rem !important;
}

/* Navbar menu centering */
.navbar-nav .nav-link {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Navbar Responsive Adjustments */
@media (max-width: 991px) {
    .navbar-nav .nav-link {
        margin: 4px 0;
        width: 100%;
    }
}

/* Mobile admin dropdown - Everything is inline now */
@media (max-width: 991px) {
    #mobileAdminMenu .dropdown-item:hover {
        background-color: #f8f9fa !important;
    }
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    background: url('../images/hospital-bg.jpg') center/cover no-repeat;
    position: relative;
    background-attachment: fixed;
}

/* Video background - FULL SCREEN */
.login-video-background {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-width: 100% !important;
    min-height: 100% !important;
    object-fit: cover !important;
    z-index: -1 !important;
}

/* Hide background image when video is present */
body.has-login-video .login-container {
    background: none !important;
    background-image: none !important;
}

/* Remove overlay when video is present */
body.has-login-video .login-container::before {
    display: none !important;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(10, 14, 39, 0.3) 0%, rgba(26, 35, 126, 0.2) 100%);
    z-index: 0;
    pointer-events: none;
}

/* Ensure login card is above video */
.login-card {
    position: relative !important;
    z-index: 10 !important;
}

.login-card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: relative;
    z-index: 1;
    background: transparent;
}

.login-header {
    background: transparent;
    color: white !important;
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
}

.login-header h2,
.login-header p,
.login-header small {
    color: white !important;
}

.login-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

/* Fixed Footer Styles for Admin Pages */
footer.bg-dark {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    padding: 0.5rem 0 !important;
    margin-top: 0 !important;
    font-size: 0.75rem;
}

footer.bg-dark .container {
    padding: 0 15px;
}

footer.bg-dark h5 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem !important;
}

footer.bg-dark h6 {
    font-size: 0.8rem;
    margin-bottom: 0.25rem !important;
}

footer.bg-dark small {
    font-size: 0.7rem;
}

footer.bg-dark .fa-2x {
    font-size: 1.5rem !important;
}

footer.bg-dark .row {
    align-items: center;
}

footer.bg-dark .mb-3 {
    margin-bottom: 0.5rem !important;
}

.facility-logo {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    color: white !important;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.login-form {
    padding: 3rem 2rem;
    background: white;
}

/* User Avatar in Navigation */
.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--medical-blue), var(--primary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.875rem;
}

.user-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Profile Page Styles */
.user-avatar-large {
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, var(--medical-blue), var(--primary-color));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
}

/* Fix admin dropdown position */
.navbar .dropdown-menu {
    position: absolute !important;
    right: 0 !important;
    left: auto !important;
    transform: none !important;
    margin-top: 0.5rem !important;
}

.navbar .dropdown-menu-end {
    right: 0 !important;
    left: auto !important;
}

/* Ensure dropdown stays within viewport on mobile */
@media (max-width: 576px) {
    .navbar .dropdown-menu {
        right: 5px !important;
        min-width: 200px !important;
        max-width: calc(100vw - 20px) !important;
    }
}

/* Reduce gap between user icons */
.navbar-nav[style*="gap: 0"] .nav-item {
    margin: 0 !important;
}

.navbar-nav[style*="gap: 0"] .nav-link {
    padding: 0.375rem 0.5rem !important;
}

/* Icon Circles for Chat and Notifications */
.icon-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

/* Chat Icon Styling */
.chat-icon {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.chat-icon:hover {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.4);
}

/* Notification Icon Styling */
.notification-icon {
    background: linear-gradient(135deg, #e74c3c, #ec7063);
    color: white;
}

.notification-icon:hover {
    background: linear-gradient(135deg, #ec7063, #e74c3c);
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

/* Logout Icon Styling */
.logout-icon {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.logout-icon:hover {
    background: linear-gradient(135deg, #c82333, #dc3545);
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff5722;
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--primary-color);
}

/* Dropdown Menu Styling */
.navbar .dropdown-menu {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    animation: dropdownOpen 0.3s ease;
}

@keyframes dropdownOpen {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.navbar .dropdown-item {
    padding: 0.6rem 1.5rem;
    transition: all 0.3s ease;
    font-weight: 500;
    text-align: center;
}

.navbar .dropdown-item:hover {
    background: linear-gradient(to right, rgba(var(--medical-orange-rgb), 0.1), rgba(var(--medical-orange-rgb), 0.05));
    color: var(--medical-orange);
    transform: translateX(5px);
}

.navbar .dropdown-item.active {
    background: linear-gradient(to right, rgba(var(--medical-orange-rgb), 0.15), rgba(var(--medical-orange-rgb), 0.1));
    color: var(--medical-orange);
    font-weight: 600;
}

.navbar .dropdown-item i {
    width: 20px;
    text-align: center;
    display: inline-block;
    margin-right: 0.5rem;
}

.navbar .dropdown-divider {
    margin: 0.5rem 0;
    border-color: rgba(0, 0, 0, 0.08);
}

/* Dashboard Styles */
.dashboard-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    background: white;
}

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

/* Fix dropdown in department cards - DEFINITIVO */
.dashboard-card {
    overflow: visible !important;
}

.dashboard-card .card-header {
    overflow: visible !important;
    position: relative;
}

/* Force dropdowns to be on top */
.dropdown-menu {
    position: fixed !important;
    z-index: 999999 !important;
}

.stats-card {
    background: linear-gradient(135deg, var(--medical-blue), var(--primary-color));
    color: white;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    transform: rotate(45deg);
}

.stats-icon {
    font-size: 3rem;
    opacity: 0.8;
    position: relative;
    z-index: 1;
}

.stats-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 0.5rem 0;
    position: relative;
    z-index: 1;
}

/* Department Cards */
.department-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    height: 200px;
    position: relative;
}

.department-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.department-card:hover::before {
    opacity: 1;
    animation: shimmer 1s ease-in-out;
}

.department-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.department-header {
    padding: 2rem 1.5rem;
    color: white;
    text-align: center;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 1;
}

.department-header h6 {
    color: white !important;
}

.department-header small {
    color: white !important;
    opacity: 0.9;
}

.department-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

/* Patient Cards */
.patient-card {
    border-left: 4px solid var(--medical-blue);
    transition: all 0.3s ease;
    background: white;
    border-radius: var(--border-radius);
}

.patient-card:hover {
    border-left-color: var(--medical-green);
    box-shadow: var(--box-shadow);
    transform: translateX(4px);
}

.patient-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--medical-blue), var(--primary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Form Styles */
.form-floating > .form-control:focus {
    border-color: var(--medical-blue);
    box-shadow: 0 0 0 0.2rem rgba(41, 128, 185, 0.25);
}

.form-floating > .form-select:focus {
    border-color: var(--medical-blue);
    box-shadow: 0 0 0 0.2rem rgba(41, 128, 185, 0.25);
}

.btn-medical {
    background: linear-gradient(135deg, var(--medical-blue), var(--primary-color));
    border: none;
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: var(--transition);
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-medical::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-medical:hover::before {
    left: 100%;
}

.btn-medical:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--medical-blue));
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(41, 128, 185, 0.3);
    color: white;
}

/* Modal Styles */
.modal-header {
    background: linear-gradient(135deg, var(--medical-blue), var(--primary-color));
    color: white;
    border-radius: 10px 10px 0 0;
    border-bottom: none;
}

.modal-content {
    border: none;
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.6);
}

/* Table Styles */
.table-medical {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.table-medical thead {
    background: linear-gradient(135deg, var(--medical-blue), var(--primary-color));
    color: white;
}

.table-medical thead th {
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.table-medical tbody tr {
    transition: background-color 0.2s ease;
}

.table-medical tbody tr:hover {
    background-color: rgba(41, 128, 185, 0.05);
}

.table-medical tbody td {
    border-color: #f8f9fa;
    vertical-align: middle;
}

/* Badge Styles */
.badge-active {
    background-color: var(--medical-green) !important;
}

.badge-inactive {
    background-color: var(--secondary-color) !important;
}

.badge-critical {
    background-color: var(--medical-red) !important;
}

.badge-warning {
    background-color: var(--medical-orange) !important;
}

/* Alert Styles */
.alert-medical {
    border: none;
    border-radius: 10px;
    border-left: 4px solid var(--medical-blue);
    background: rgba(41, 128, 185, 0.1);
    color: var(--dark-color);
}

/* Loading Spinner */
.spinner-medical {
    border: 3px solid var(--light-color);
    border-top: 3px solid var(--medical-blue);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* Navigation Styles */
.navbar-brand {
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
}

.navbar-nav .nav-link {
    transition: var(--transition);
    border-radius: 6px;
    margin: 0 2px;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Dropdown Styles */
.dropdown-menu {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: rgba(41, 128, 185, 0.1);
    color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .login-card {
        margin: 1rem;
    }
    
    .login-header {
        padding: 2rem 1.5rem;
    }
    
    .login-form {
        padding: 2rem 1.5rem;
    }
    
    .department-card {
        height: 160px;
    }
    
    .department-icon {
        font-size: 2.5rem;
    }
    
    .stats-number {
        font-size: 2rem;
    }
    
    .stats-card {
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .facility-logo {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .stats-icon {
        font-size: 2rem;
    }
    
    .department-icon {
        font-size: 2rem;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--medical-blue);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.6s ease-in;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.slide-in {
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from { 
        transform: translateX(-100px); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0); 
        opacity: 1; 
    }
}

/* Pulse Animation for Important Elements */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Professional Color Variants */
.bg-medical-blue {
    background-color: var(--medical-blue) !important;
}

.bg-medical-green {
    background-color: var(--medical-green) !important;
}

.bg-medical-red {
    background-color: var(--medical-red) !important;
}

.bg-medical-orange {
    background-color: var(--medical-orange) !important;
}

.text-medical-blue {
    color: var(--medical-blue) !important;
}

/* Print Styles */
@media print {
    .navbar, .btn, .modal, footer, .dropdown {
        display: none !important;
    }
    
    .container-fluid {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
    
    .page-break {
        page-break-after: always;
    }
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Styles for Better Accessibility */
button:focus,
.btn:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--medical-blue);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000080;
        --medical-blue: #000080;
        --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Calendar Styles */
.calendar-day-header {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    text-align: center;
    vertical-align: top;
    padding: 4px 2px;
    position: relative;
}

.calendar-day-header.holiday {
    background-color: #ffe6e6 !important;
}

.calendar-day-header.weekend {
    background-color: #e6f2ff !important;
}

.shift-cell {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    height: 50px;
    text-align: center;
    cursor: pointer;
    position: relative;
    padding: 2px;
}

.shift-cell.weekend {
    background-color: #f0f8ff;
}

.shift-cell.holiday {
    background-color: #fff5f5;
}

/* Holiday text styling */
.calendar-day-header .text-danger {
    display: block;
    word-break: break-word;
    hyphens: auto;
    text-align: center;
    padding: 0 1px;
}

/* Staff name cells with colored borders */
.staff-name-cell {
    border-left: 4px solid #dee2e6 !important;
    border-right: 3px solid #dee2e6 !important;
}

/* Colored borders for different staff members */
.staff-row-0 .staff-name-cell { border-left-color: #e74c3c !important; border-right-color: #e74c3c !important; }
.staff-row-1 .staff-name-cell { border-left-color: #3498db !important; border-right-color: #3498db !important; }
.staff-row-2 .staff-name-cell { border-left-color: #2ecc71 !important; border-right-color: #2ecc71 !important; }
.staff-row-3 .staff-name-cell { border-left-color: #f39c12 !important; border-right-color: #f39c12 !important; }
.staff-row-4 .staff-name-cell { border-left-color: #9b59b6 !important; border-right-color: #9b59b6 !important; }
.staff-row-5 .staff-name-cell { border-left-color: #1abc9c !important; border-right-color: #1abc9c !important; }
.staff-row-6 .staff-name-cell { border-left-color: #e67e22 !important; border-right-color: #e67e22 !important; }
.staff-row-7 .staff-name-cell { border-left-color: #34495e !important; border-right-color: #34495e !important; }
.staff-row-8 .staff-name-cell { border-left-color: #16a085 !important; border-right-color: #16a085 !important; }
.staff-row-9 .staff-name-cell { border-left-color: #27ae60 !important; border-right-color: #27ae60 !important; }
.staff-row-10 .staff-name-cell { border-left-color: #2980b9 !important; border-right-color: #2980b9 !important; }
.staff-row-11 .staff-name-cell { border-left-color: #8e44ad !important; border-right-color: #8e44ad !important; }
.staff-row-12 .staff-name-cell { border-left-color: #2c3e50 !important; border-right-color: #2c3e50 !important; }
.staff-row-13 .staff-name-cell { border-left-color: #f1c40f !important; border-right-color: #f1c40f !important; }
.staff-row-14 .staff-name-cell { border-left-color: #e74c3c !important; border-right-color: #e74c3c !important; }
.staff-row-15 .staff-name-cell { border-left-color: #3498db !important; border-right-color: #3498db !important; }

/* Professional healthcare interface completed */

/* Patient Cards for Triage Grid */
.patient-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.patient-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.patient-card.code-red {
    border-color: #dc3545;
    background: linear-gradient(135deg, #fff 0%, #fff5f5 100%);
}

.patient-card.code-orange {
    border-color: #ff6b35;
    background: linear-gradient(135deg, #fff 0%, #fff8f5 100%);
}

.patient-card.code-blue {
    border-color: #4a90e2;
    background: linear-gradient(135deg, #fff 0%, #f0f7ff 100%);
}

.patient-card.code-green {
    border-color: #28a745;
    background: linear-gradient(135deg, #fff 0%, #f5fff7 100%);
}

.patient-card.code-white {
    border-color: #6c757d;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
}

.patient-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.patient-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.patient-age {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.priority-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: white;
}

.priority-badge.red {
    background: #dc3545;
}

.priority-badge.orange {
    background: #ff6b35;
}

.priority-badge.blue {
    background: #4a90e2;
}

.priority-badge.green {
    background: #28a745;
}

.priority-badge.white {
    background: #6c757d;
}

.patient-info {
    margin: 10px 0;
}

.patient-info-item {
    display: flex;
    align-items: center;
    margin: 8px 0;
    font-size: 0.9rem;
    color: #555;
}

.patient-info-item i {
    width: 20px;
    margin-right: 10px;
    color: #007bff;
}

.patient-symptom {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-top: 10px;
}

.waiting-time {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.patient-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.patient-actions button {
    flex: 1;
    padding: 6px 12px;
    font-size: 0.85rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-call-patient {
    background: #007bff;
    color: white;
}

.btn-call-patient:hover {
    background: #0056b3;
}

.btn-take-charge {
    background: #28a745;
    color: white;
}

.btn-take-charge:hover {
    background: #218838;
}

.postazione-icon {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: #e9ecef;
    border-radius: 4px;
    font-size: 0.8rem;
}

.postazione-icon i {
    font-size: 1rem;
}

/* Symptom Triage Styles - Modern & Guided Interface */
.symptom-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.symptom-category {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.symptom-category:hover {
    border-color: #007bff;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.2);
}

.symptom-category.selected {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-color: #0056b3;
}

.symptom-category i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
}

.symptom-category span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 5px;
}

.search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background: #f8f9fa;
}

.search-result-item .symptom-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
}

.search-result-item .symptom-category-name {
    font-size: 0.85rem;
    color: #666;
}

/* Symptom Search Container */
.symptom-search-container {
    position: relative;
}

/* Protocol Alert */
#protocolAlert {
    border-radius: 10px;
    border-left: 5px solid #007bff;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Selected Symptoms Panel */
.selected-symptoms-panel {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e9ecef;
}

.selected-symptoms-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.selected-symptom-item {
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.selected-symptom-item .symptom-info {
    flex-grow: 1;
}

.selected-symptom-item .priority-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Priority Guide Items */
.priority-guide-item {
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    border: 2px solid transparent;
}

.priority-guide-item.rosso {
    background: #ffebee;
    border-color: #ef5350;
}

.priority-guide-item.arancione {
    background: #fff3e0;
    border-color: #ff9800;
}

.priority-guide-item.azzurro {
    background: #e3f2fd;
    border-color: #2196f3;
}

.priority-guide-item.verde {
    background: #e8f5e9;
    border-color: #4caf50;
}

.priority-guide-item.bianco {
    background: #fafafa;
    border-color: #9e9e9e;
}

.priority-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-badge.rosso {
    background: #d32f2f;
    color: white;
}

.priority-badge.arancione {
    background: #f57c00;
    color: white;
}

.priority-badge.azzurro {
    background: #1976d2;
    color: white;
}

.priority-badge.verde {
    background: #388e3c;
    color: white;
}

.priority-badge.bianco {
    background: #757575;
    color: white;
}

.priority-criteria {
    margin-top: 5px;
    font-size: 0.9rem;
}

.vital-signs {
    color: #666;
    font-style: italic;
}

/* Symptom Details Card */
.symptom-details-card {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: none;
    margin-top: 20px;
}

.symptom-details-card .card-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-radius: 8px 8px 0 0 !important;
    padding: 15px 20px;
}

.symptom-item {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 15px;
}

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

.symptom-item h6 {
    color: #333;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Helper Text */
.helper-text {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 12px 15px;
    border-radius: 4px;
    margin: 15px 0;
    font-size: 0.9rem;
    color: #1565c0;
}

.helper-text i {
    margin-right: 8px;
}
