/**
 * STILE - Sistema Gestione Sostituzioni
 */

/* =====================================================
   RESET E BASE
   ===================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --secondary: #5f6368;
    --success: #34a853;
    --warning: #fbbc04;
    --danger: #ea4335;
    --info: #4285f4;
    
    --bg: #f8f9fa;
    --bg-card: #ffffff;
    --border: #dadce0;
    --text: #202124;
    --text-light: #5f6368;
    
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
}

html {
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

/* =====================================================
   NAVBAR - Mobile First con Hamburger Menu
   ===================================================== */
.navbar {
    background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 100%);
    color: #333;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #e0e6ed;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Hamburger Button */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.hamburger:hover,
.hamburger:active {
    background: rgba(26, 115, 232, 0.1);
}

.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: #333;
    border-radius: 2px;
    transition: all 0.3s ease;
    margin: 2px 0;
}

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

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

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

.navbar-brand a {
    color: #1a73e8;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-brand .brand-text {
    background: linear-gradient(135deg, #1a73e8 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 0.95rem;
}

.navbar-logo {
    height: 32px;
    width: auto;
    max-width: 40px;
    object-fit: contain;
    border-radius: 6px;
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100%;
    background: white;
    z-index: 1002;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu.open {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px;
    background: linear-gradient(135deg, #1a73e8 0%, #6366f1 100%);
    color: white;
    min-height: 80px;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-user-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

.mobile-user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.mobile-user-role {
    font-size: 0.75rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-menu-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-close:hover,
.mobile-menu-close:active {
    background: rgba(255, 255, 255, 0.25);
}

.mobile-menu-items {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    color: #333;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item:hover,
.mobile-nav-item:active {
    background: #f5f7ff;
    color: #1a73e8;
}

.mobile-nav-item.active {
    background: linear-gradient(90deg, rgba(26, 115, 232, 0.1) 0%, transparent 100%);
    color: #1a73e8;
    border-left-color: #1a73e8;
    font-weight: 600;
}

.mobile-nav-item .nav-icon {
    font-size: 1.3rem;
    width: 28px;
    text-align: center;
}

.mobile-nav-item.nav-admin {
    color: #d97706;
}

.mobile-nav-item.nav-admin:hover,
.mobile-nav-item.nav-admin:active {
    background: #fffbeb;
    color: #b45309;
}

.mobile-nav-item.nav-admin.active {
    background: linear-gradient(90deg, rgba(217, 119, 6, 0.1) 0%, transparent 100%);
    border-left-color: #d97706;
}

.mobile-nav-item.mobile-logout {
    color: #dc2626;
}

.mobile-nav-item.mobile-logout:hover,
.mobile-nav-item.mobile-logout:active {
    background: #fef2f2;
    color: #b91c1c;
}

.mobile-menu-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 16px;
}

.mobile-menu-section {
    padding: 12px 20px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9ca3af;
}

/* Desktop Menu (nascosto su mobile) */
.desktop-menu {
    display: none;
    background: linear-gradient(135deg, #fafbff 0%, #f0f4ff 100%);
    padding: 8px 16px;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
    border-bottom: 1px solid #e0e6ed;
    position: sticky;
    top: 60px;
    z-index: 999;
}

.desktop-menu .nav-item {
    color: #555;
    text-decoration: none;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 10px;
}

.desktop-menu .nav-item:hover {
    color: #1a73e8;
    background: rgba(26, 115, 232, 0.08);
}

.desktop-menu .nav-item.active {
    color: #1a73e8;
    background: rgba(26, 115, 232, 0.12);
    font-weight: 600;
}

.desktop-menu .nav-item .nav-icon {
    font-size: 1rem;
}

/* Badge notifiche */
.notifica-badge {
    background: linear-gradient(135deg, #ea4335 0%, #d32f2f 100%);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    margin-left: 4px;
    animation: pulse-badge 2s infinite;
}

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

.mobile-nav-item .notifica-badge {
    margin-left: auto;
}

.desktop-menu .nav-admin {
    color: #d97706;
}

.desktop-menu .nav-admin:hover {
    color: #b45309;
    background: rgba(217, 119, 6, 0.1);
}

.desktop-menu .nav-admin.active {
    background: rgba(217, 119, 6, 0.15);
}

/* User section in navbar */
.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: none;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
}

.user-role {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-logout {
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-logout:hover,
.btn-logout:active {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
}

/* Nascondi logout su mobile piccoli (c'è nel menu) */
@media (max-width: 480px) {
    .navbar .btn-logout {
        display: none;
    }
}

/* Body quando menu è aperto */
body.menu-open {
    overflow: hidden;
}

/* =====================================================
   RESPONSIVE - Tablet (768px+)
   ===================================================== */
@media (min-width: 768px) {
    .navbar {
        padding: 0 24px;
    }
    
    .navbar-brand .brand-text {
        font-size: 1.05rem;
    }
    
    .user-info {
        display: flex;
    }
    
    .btn-logout {
        display: flex;
    }
}

/* =====================================================
   RESPONSIVE - Desktop (1024px+)
   ===================================================== */
@media (min-width: 1024px) {
    .hamburger {
        display: none;
    }
    
    .mobile-menu,
    .menu-overlay {
        display: none !important;
    }
    
    .desktop-menu {
        display: flex;
    }
    
    .navbar {
        height: 56px;
    }
    
    .navbar-brand .brand-text {
        font-size: 1.1rem;
    }
    
    .btn-logout {
        padding: 8px 16px;
    }
}

/* =====================================================
   RESPONSIVE - Large Desktop (1280px+)
   ===================================================== */
@media (min-width: 1280px) {
    .desktop-menu {
        gap: 6px;
    }
    
    .desktop-menu .nav-item {
        padding: 10px 18px;
        font-size: 0.88rem;
    }
}

/* =====================================================
   CONTAINER
   ===================================================== */
.container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    overflow-x: hidden;
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2,
.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    min-height: 40px;
}

/* Touch-friendly buttons su mobile */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        padding: 12px 18px;
    }
    
    .btn-sm {
        min-height: 38px;
        padding: 8px 14px;
    }
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #2d8e47;
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #d33426;
}

.btn-outline {
    background: transparent;
    border: 1px solid currentColor;
    color: white;
}

.btn-outline:hover {
    background: rgba(255,255,255,0.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =====================================================
   FORMS
   ===================================================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.form-control:disabled {
    background: var(--bg);
    cursor: not-allowed;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235f6368' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.form-text {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* =====================================================
   TABLES
   ===================================================== */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
}

.table tbody tr:hover {
    background: rgba(0,0,0,0.02);
}

.table-striped tbody tr:nth-child(even) {
    background: var(--bg);
}

/* Tabella responsive con scroll orizzontale */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 15px;
}

.table-responsive .table {
    min-width: 600px;
}

/* Tabella compatta per mobile */
.table-mobile-friendly th,
.table-mobile-friendly td {
    padding: 10px 12px;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .table-responsive .table {
        min-width: 500px;
    }
}

/* =====================================================
   BADGES
   ===================================================== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
}

.badge-admin {
    background: #fce8e6;
    color: var(--danger);
}

.badge-operatore {
    background: #e8f0fe;
    color: var(--primary);
}

.badge-success {
    background: #e6f4ea;
    color: var(--success);
}

.badge-warning {
    background: #fef7e0;
    color: #b06000;
}

.badge-danger {
    background: #fce8e6;
    color: var(--danger);
}

.badge-info {
    background: #e8f0fe;
    color: var(--info);
}

.badge-secondary {
    background: #e8eaed;
    color: var(--secondary);
}

/* Badges per tipo sostituto */
.badge-compresenza {
    background: #e6f4ea;
    color: #137333;
}

.badge-disposizione {
    background: #fef7e0;
    color: #b06000;
}

.badge-libero {
    background: #e8f0fe;
    color: #1967d2;
}

.badge-buca {
    background: #f3e8fd;
    color: #7627bb;
}

.badge-classe_fuori {
    background: #fce8e6;
    color: #c5221f;
}

.badge-sostegno {
    background: #f3e8fd;
    color: #7627bb;
}

/* =====================================================
   ALERTS
   ===================================================== */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-success {
    background: #e6f4ea;
    color: #137333;
    border-left: 4px solid var(--success);
}

.alert-error {
    background: #fce8e6;
    color: #c5221f;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: #fef7e0;
    color: #b06000;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: #e8f0fe;
    color: #1967d2;
    border-left: 4px solid var(--info);
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.5;
    line-height: 1;
}

.alert-close:hover {
    opacity: 1;
}

/* =====================================================
   STATS CARDS
   ===================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-card .stat-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
}

.stat-card .stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
}

.stat-card.stat-primary {
    border-left: 4px solid var(--primary);
}

.stat-card.stat-success {
    border-left: 4px solid var(--success);
}

.stat-card.stat-warning {
    border-left: 4px solid var(--warning);
}

.stat-card.stat-danger {
    border-left: 4px solid var(--danger);
}

/* =====================================================
   SOSTITUZIONE CARD
   ===================================================== */
.sost-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 12px;
    overflow: hidden;
}

.sost-card.da_assegnare {
    border-left: 4px solid var(--warning);
}

.sost-card.assegnata {
    border-left: 4px solid var(--success);
}

.sost-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg);
}

.sost-ora {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 50px;
}

.sost-info {
    flex: 1;
    margin: 0 16px;
}

.sost-classe {
    font-weight: 600;
    font-size: 1.1rem;
}

.sost-docente {
    color: var(--text-light);
    font-size: 0.9rem;
}

.sost-body {
    padding: 16px;
}

.sost-sostituto {
    font-size: 1.1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sost-sostituto.vuoto {
    color: var(--warning);
    font-style: italic;
}

.sost-aula {
    color: var(--text-light);
    margin-top: 4px;
}

.sost-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* =====================================================
   MODAL / DIALOG
   ===================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    transform: translateY(-20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =====================================================
   DOCENTE BUTTONS (per selezione sostituto)
   ===================================================== */
.docenti-section {
    margin-bottom: 16px;
}

.docenti-section-title {
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 8px;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.docenti-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.docente-btn {
    padding: 8px 14px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.docente-btn.compresenza {
    background: #e6f4ea;
    color: #137333;
}

.docente-btn.sostegno {
    background: #f3e8fd;
    color: #7627bb;
}

.docente-btn.disposizione {
    background: #fef7e0;
    color: #b06000;
}

.docente-btn.libero {
    background: #e8f0fe;
    color: #1967d2;
}

.docente-btn.buca {
    background: #fce8e6;
    color: #c5221f;
}

.docente-btn.classe_fuori {
    background: #e0f7fa;
    color: #00695c;
}

.docente-btn.alunno_h {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 2px solid #ce93d8;
}

.docente-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.docente-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.docente-btn .icon {
    font-size: 0.8rem;
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text);
}

.login-box .logo {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 10px;
}

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* =====================================================
   UTILITIES
   ===================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: #b06000; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }

.hidden { display: none !important; }

/* =====================================================
   TOOLBAR RESPONSIVE
   ===================================================== */
.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.page-toolbar h1 {
    font-size: 1.3rem;
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.toolbar-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* Responsive utility classes */
@media (max-width: 768px) {
    .d-flex.justify-between {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .d-flex.justify-between > h1 {
        width: 100%;
        font-size: 1.2rem;
        margin-bottom: 8px;
    }
    
    .d-flex.justify-between > form {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    .page-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-toolbar h1 {
        font-size: 1.2rem;
        text-align: center;
        width: 100%;
    }
    
    .toolbar-controls {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .d-flex.gap-1 {
        gap: 4px;
    }
    
    /* Pulsanti più piccoli su mobile */
    .btn-sm {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    /* Hide text, show only arrows on very small screens */
    .btn-nav-text {
        display: none;
    }
    
    /* Nascondi elementi su mobile piccoli */
    .hide-mobile {
        display: none !important;
    }
}

/* Classe per nascondere su mobile */
@media (max-width: 768px) {
    .hide-mobile-md {
        display: none !important;
    }
}

/* Classe per mostrare solo su mobile */
.show-mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .show-mobile-only {
        display: block;
    }
}

/* =====================================================
   PAGINA PUBBLICA
   ===================================================== */
.public-page {
    background: white;
    min-height: 100vh;
}

.public-header {
    background: var(--primary);
    color: white;
    padding: 20px;
    text-align: center;
}

.public-header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.public-header .date {
    font-size: 1.2rem;
    opacity: 0.9;
}

.public-content {
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.public-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.public-table th,
.public-table td {
    padding: 10px 12px;
    border: 1px solid #ddd;
}

.public-table th {
    background: var(--bg);
    font-weight: 600;
}

.public-table .docente-assente {
    background: #fff3e0;
}

.print-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    font-size: 1rem;
}

@media print {
    .print-btn { display: none; }
    .public-header { background: #333 !important; -webkit-print-color-adjust: exact; }
}

/* =====================================================
   RESPONSIVE MOBILE - Ottimizzazioni generali
   ===================================================== */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-row .form-group {
        min-width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
    }
    
    /* Nascondi colonne meno importanti su mobile */
    .table .hide-mobile {
        display: none;
    }
    
    /* Cards più compatte */
    .card {
        border-radius: 12px;
    }
    
    .card-header,
    .card-body {
        padding: 12px 14px;
    }
    
    /* Pulsanti touch-friendly */
    .btn {
        min-height: 44px;
        padding: 10px 16px;
    }
    
    /* Form inputs più grandi per touch */
    .form-control {
        min-height: 44px;
        font-size: 16px; /* Previene zoom su iOS */
    }
    
    select.form-control {
        font-size: 16px;
    }
    
    /* Alert più compatto */
    .alert {
        padding: 12px 14px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 14px;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    h1, .page-title {
        font-size: 1.4rem;
    }
    
    h2 {
        font-size: 1.2rem;
    }
}

/* =====================================================
   QUICK ACTIONS - Bottoni azioni rapide migliorati
===================================================== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 480px) {
    .quick-actions {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    border-radius: 12px;
    text-decoration: none;
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    min-height: 100px;
    position: relative;
    overflow: hidden;
}

.quick-action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.quick-action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.quick-action-btn .icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.quick-action-btn .label {
    font-size: 0.95rem;
    text-align: center;
}

.quick-action-btn .badge-count {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.3);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* Colori specifici per ogni azione */
.quick-action-btn.action-sostituzioni {
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
}

.quick-action-btn.action-assenze {
    background: linear-gradient(135deg, #ea4335 0%, #b71c1c 100%);
}

.quick-action-btn.action-offerte {
    background: linear-gradient(135deg, #ff9800 0%, #e65100 100%);
}

.quick-action-btn.action-classi {
    background: linear-gradient(135deg, #9c27b0 0%, #6a1b9a 100%);
}

.quick-action-btn.action-disponibilita {
    background: linear-gradient(135deg, #00bcd4 0%, #00838f 100%);
}

.quick-action-btn.action-report {
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
}

.quick-action-btn.action-admin {
    background: linear-gradient(135deg, #607d8b 0%, #37474f 100%);
}

.quick-action-btn.action-guida {
    background: linear-gradient(135deg, #795548 0%, #4e342e 100%);
}

/* Badge warning animato */
.badge-pulse {
    animation: pulse 2s infinite;
}

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

/* Miglioramento stat-card */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}
