/* ========== BASE RESET & TYPOGRAPHY ========== */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
    margin: 0;
}
.font-display { font-family: 'Outfit', sans-serif; }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ========== SIDEBAR ========== */
.sidebar-link { transition: all 0.2s; }
.sidebar-link:hover {
    background-color: #f1f5f9;
    color: #0f172a;
    transform: translateX(4px);
}

/* ========== GLASS PANEL ========== */
.glass-panel {
    border: none !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03) !important;
    overflow: hidden !important;
    background-color: white !important;
}

/* ========== LOGIN CARD ========== */
.login-card {
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.5);
}
input::placeholder { color: #cbd5e1; }
input:focus { background-color: white; }

/* ========== MODAL ========== */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}
.modal-content {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

/* ========== GRADE BADGES (small) ========== */
.grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    margin-right: 4px;
    margin-bottom: 4px;
    border: 1px solid transparent;
    transition: transform 0.2s;
}
.grade-badge:hover { transform: scale(1.1); }

/* ========== GRADE BOXES (large, square) ========== */
.grade-box {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
    font-family: 'Outfit', sans-serif !important;
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    margin: 3px !important;
    cursor: pointer !important;
    transition: transform 0.2s, box-shadow 0.2s !important;
    background-color: #ffffff !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
}
.grade-box:hover {
    transform: translateY(-3px) scale(1.05) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    z-index: 10 !important;
}

/* Grade Colors */
.grade-red { color: #dc2626 !important; border: 2px solid #fecaca !important; background-color: #fef2f2 !important; }
.grade-orange { color: #ea580c !important; border: 2px solid #fed7aa !important; background-color: #fff7ed !important; }
.grade-green { color: #16a34a !important; border: 2px solid #bbf7d0 !important; background-color: #f0fdf4 !important; }
.grade-blue { color: #2563eb !important; border: 2px solid #bfdbfe !important; background-color: #eff6ff !important; }

/* ========== DATATABLES OVERRIDES ========== */
table.dataTable thead th {
    background-color: #f8fafc !important;
    color: #64748b !important;
    font-family: 'Outfit', sans-serif !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 1.5rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
table.dataTable thead th:first-child { border-top-left-radius: 16px !important; }
table.dataTable thead th:last-child { border-top-right-radius: 16px !important; }
table.dataTable tbody tr {
    border-bottom: 1px solid #cbd5e1 !important;
    transition: all 0.2s;
}
table.dataTable tbody tr:nth-child(odd) { background-color: #ffffff !important; }
table.dataTable tbody tr:nth-child(even) { background-color: #f1f5f9 !important; }
table.dataTable tbody tr:hover { background-color: #e2e8f0 !important; }

.dataTables_wrapper .dataTables_length select {
    padding-right: 2rem;
    border-radius: 0.5rem;
    border-color: #e2e8f0;
}
.dataTables_wrapper .dataTables_filter input {
    border-radius: 0.5rem;
    border-color: #e2e8f0;
    padding: 0.5rem 1rem;
}
table.dataTable tbody tr:last-child { border-bottom: none; }

/* ========== STUDENTS TABLE (registroClasse / gestioneClasse) ========== */
.students-table thead th {
    background-color: #f8fafc !important;
    color: #64748b !important;
    font-family: 'Outfit', sans-serif !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 1.5rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
.students-table tbody tr {
    border-bottom: 1px solid #e2e8f0 !important;
    transition: all 0.2s;
}
.students-table tbody tr:hover { background-color: #f1f5f9 !important; }

/* ========== BULLETIN TABLE (bacheca) ========== */
.bulletin-table thead th {
    background-color: #f8fafc !important;
    color: #64748b !important;
    font-family: 'Outfit', sans-serif !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 1.5rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
.bulletin-table thead th:first-child { border-top-left-radius: 16px !important; }
.bulletin-table thead th:last-child { border-top-right-radius: 16px !important; }
.bulletin-table tbody tr {
    border-bottom: 1px solid #e2e8f0 !important;
    cursor: pointer;
}
.bulletin-table tbody tr:nth-child(odd) { background-color: #ffffff !important; }
.bulletin-table tbody tr:nth-child(even) { background-color: #f8fafc !important; }
.bulletin-table tbody tr:hover { background-color: #f1f5f9 !important; }

/* ========== STATUS BADGES (assenze, registroClasse) ========== */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.status-present { background-color: #dcfce7; color: #166534; }
.status-absent { background-color: #fef2f2; color: #dc2626; }
.status-late { background-color: #fef3c7; color: #d97706; }
.status-red { background-color: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.status-green { background-color: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.status-yellow { background-color: #fefce8; color: #ca8a04; border: 1px solid #fef08a; }

/* ========== NOTE BADGES ========== */
.note-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.note-merit { background-color: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.note-disciplinary { background-color: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.note-annotation { background-color: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }

/* ========== CATEGORY BADGES (bacheca) ========== */
.badge-category {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cat-Circolare { background-color: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.cat-Avviso { background-color: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.cat-Modulistica { background-color: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* ========== DOWNLOAD BUTTON ========== */
.btn-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background-color: #f1f5f9;
    color: #475569;
    transition: all 0.2s;
}
.btn-download:hover {
    background-color: #e2e8f0;
    color: #0f172a;
    transform: translateY(-2px);
}

/* ========== CALENDAR ========== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #e2e8f0;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}
.calendar-day-header {
    background-color: #f8fafc;
    color: #64748b;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem 0.5rem;
    text-align: center;
}
.calendar-day {
    background-color: white;
    min-height: 80px;
    padding: 0.5rem;
    transition: background-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.calendar-day:hover { background-color: #f8fafc; }
.day-number {
    font-weight: 600;
    color: #475569;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.day-today .day-number { background-color: #2563eb; color: white; }
.day-other-month { background-color: #fcfcfc; color: #cbd5e1; }

/* Event Pills */
.event-pill {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: transform 0.1s;
}
.event-pill:hover { transform: scale(1.02); z-index: 10; }
.event-exam { background-color: #fff1f2; color: #be123c; border-left-color: #e11d48; }
.event-general { background-color: #eff6ff; color: #1d4ed8; border-left-color: #3b82f6; }

/* ========== HOMEWORK (compiti) ========== */
.homework-grid { display: grid; grid-template-columns: repeat(1, 1fr); gap: 1.5rem; }
@media (min-width: 1024px) { .homework-grid { grid-template-columns: repeat(6, 1fr); } }
.day-card { background: white; border-radius: 1.5rem; padding: 1.5rem; border: 1px solid #e2e8f0; transition: all 0.3s ease; display: flex; flex-direction: column; gap: 1rem; min-height: 400px; }
.day-card:hover { border-color: #3b82f6; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05); }
.day-header { border-bottom: 1px solid #f1f5f9; padding-bottom: 0.75rem; }
.task-item { padding: 1rem; border-radius: 1rem; background: #f8fafc; border: 1px solid #f1f5f9; position: relative; cursor: pointer; transition: all 0.2s ease; }
.task-item:hover { background: white; border-color: #3b82f6; transform: translateY(-2px); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); }
.task-subject { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.25rem; }
.is-today { border: 2px solid #3b82f6 !important; box-shadow: 0 0 0 1px rgba(59,130,246,0.2), 0 8px 16px -4px rgba(59,130,246,0.15) !important; }
.is-today .day-header h3 { color: #2563eb; font-weight: 800; }