/* Import Google Fonts (Outfit & Chakra Petch for Thai) */
@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-color: #4f46e5;       /* Indigo */
    --primary-hover: #4338ca;
    --secondary-color: #0d9488;     /* Teal */
    --secondary-hover: #0f766e;
    --bg-gradient-start: #0f172a;   /* Slate 900 */
    --bg-gradient-end: #1e1b4b;     /* Indigo 950 */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7); /* Dark semi-transparent slate */
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.3);
    --card-hover-bg: rgba(255, 255, 255, 0.05);
    
    --success: #10b981;             /* Emerald 500 */
    --warning: #f59e0b;             /* Amber 500 */
    --danger: #ef4444;              /* Red 500 */
    --info: #06b6d4;                /* Cyan 500 */
    
    --transition-speed: 0.3s;
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
}

/* Light Mode Variables overrides if user toggles (handled via class on body) */
body.light-theme {
    --bg-gradient-start: #f1f5f9;   /* Slate 100 */
    --bg-gradient-end: #e0e7ff;     /* Indigo 100 */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(79, 70, 229, 0.12);
    --glass-shadow: rgba(79, 70, 229, 0.08);
    --card-hover-bg: rgba(79, 70, 229, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Chakra Petch', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: background var(--transition-speed), color var(--transition-speed);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==========================================
   GLASSMORPHISM UTILITIES
   ========================================== */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 var(--glass-shadow);
    border-radius: var(--border-radius-lg);
}

.glass-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.15);
    border-radius: var(--border-radius-md);
    padding: 20px;
    transition: transform var(--transition-speed) cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                box-shadow var(--transition-speed), 
                background-color var(--transition-speed);
}
.light-theme .glass-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.03);
}
.glass-card:hover {
    transform: translateY(-5px);
    background-color: var(--card-hover-bg);
    box-shadow: 0 12px 24px 0 rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.1);
}
.light-theme .glass-card:hover {
    box-shadow: 0 12px 24px 0 rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.2);
}

/* ==========================================
   LOGIN SCREEN
   ========================================== */
.login-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 480px;
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header .logo-icon {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px rgba(13, 148, 136, 0.4));
}

.login-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(to right, #a5b4fc, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}
.light-theme .login-header h1 {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Form Styling */
.form-group {
    margin-bottom: 20px;
}

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

.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.form-control {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-speed);
}
.light-theme .form-control {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(79, 70, 229, 0.15);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
    background: rgba(0, 0, 0, 0.3);
}
.light-theme .form-control:focus {
    background: #fff;
}

.btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(to right, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: linear-gradient(to right, var(--secondary-color), var(--secondary-hover));
}
.btn-secondary:hover {
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
}

.btn-danger {
    background: linear-gradient(to right, var(--danger), #b91c1c);
}
.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}
.btn-glass:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.btn:active {
    transform: translateY(0);
}

/* Quick demo logins options */
.demo-accounts {
    margin-top: 30px;
    border-top: 1px solid var(--glass-border);
    padding-top: 20px;
}

.demo-accounts p {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.demo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.btn-demo {
    padding: 8px;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-speed);
    font-family: inherit;
    text-align: center;
}
.light-theme .btn-demo {
    background: rgba(0, 0, 0, 0.02);
}

.btn-demo:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
}
.light-theme .btn-demo:hover {
    background: rgba(79, 70, 229, 0.06);
}

/* Alert Notification */
.alert-box {
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}
.light-theme .alert-danger {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: #b91c1c;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #a7f3d0;
}
.light-theme .alert-success {
    background: #ecfdf5;
    border: 1px solid #d1fae5;
    color: #065f46;
}

/* ==========================================
   MAIN SYSTEM LAYOUT
   ========================================== */
.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* Sidebar navigation */
.sidebar {
    width: 280px;
    min-height: 100vh;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    flex-shrink: 0;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-left: 10px;
}

.sidebar-brand i {
    font-size: 1.8rem;
    color: var(--secondary-color);
}

.sidebar-brand span {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.light-theme .sidebar-brand span {
    background: linear-gradient(to right, #000, #475569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-user {
    padding: 15px;
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.light-theme .sidebar-user {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-user .avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.sidebar-user-info {
    overflow: hidden;
}

.sidebar-user-info .name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.sidebar-user-info .role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 4px;
}

.badge-executive {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.light-theme .badge-executive {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-teacher {
    background: rgba(13, 148, 136, 0.15);
    color: #2dd4bf;
    border: 1px solid rgba(13, 148, 136, 0.2);
}
.light-theme .badge-teacher {
    background: #ccfbf1;
    color: #0f766e;
}

.badge-student {
    background: rgba(79, 70, 229, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(79, 70, 229, 0.2);
}
.light-theme .badge-student {
    background: #e0e7ff;
    color: #4338ca;
}

.sidebar-menu {
    list-style: none;
    flex-grow: 1;
}

.sidebar-menu li {
    margin-bottom: 8px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-speed);
}

.sidebar-menu a i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-menu a:hover,
.sidebar-menu li.active a {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}
.light-theme .sidebar-menu a:hover,
.light-theme .sidebar-menu li.active a {
    background: rgba(79, 70, 229, 0.06);
    color: var(--primary-color);
}

.sidebar-menu li.active a {
    border-left: 4px solid var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
}

.sidebar-footer {
    border-top: 1px solid var(--glass-border);
    padding-top: 20px;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #ef4444;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-speed);
}

.sidebar-footer a:hover {
    background: rgba(239, 68, 68, 0.08);
}

/* ==========================================
   MAIN CONTENT AREA
   ========================================== */
.main-content {
    flex-grow: 1;
    min-height: 100vh;
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Header styling */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.header-title h2 {
    font-size: 1.6rem;
    font-weight: 700;
}

.header-title p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Theme toggle switch button */
.theme-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    font-size: 1.1rem;
    transition: all var(--transition-speed);
}
.light-theme .theme-toggle {
    background: rgba(0, 0, 0, 0.02);
}
.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(20deg);
}

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

.stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-info .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-info .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--border-radius-md);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    color: white;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.stat-icon.teal {
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    box-shadow: 0 4px 14px rgba(20, 184, 166, 0.35);
}

.stat-icon.amber {
    background: linear-gradient(135deg, #f59e0b, #b45309);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.stat-icon.purple {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35);
}

/* ==========================================
   DASHBOARD MAIN LAYOUT GRIDS
   ========================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 30px;
}

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

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.light-theme .panel-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.panel-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h3 i {
    color: var(--secondary-color);
}

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

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.custom-table th {
    padding: 14px 16px;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}
.light-theme .custom-table th {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.custom-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}
.light-theme .custom-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

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

.custom-table tr {
    transition: background-color var(--transition-speed);
}

.custom-table tr:hover td {
    background-color: var(--card-hover-bg);
}

/* ==========================================
   NOTIFICATIONS / ANNOUNCEMENTS LIST
   ========================================== */
.announcement-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.announcement-item {
    padding: 15px;
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: all var(--transition-speed);
}
.light-theme .announcement-item {
    background: rgba(0, 0, 0, 0.01);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.announcement-item:hover {
    background: var(--card-hover-bg);
}

.announcement-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.announcement-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.announcement-item h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.announcement-item p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ==========================================
   BADGES (STATUS ETC.)
   ========================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    gap: 5px;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

/* Status: Pending / Sick */
.badge-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}
.badge-pending::before { background-color: #f59e0b; }
.light-theme .badge-pending {
    background: #fef3c7;
    color: #d97706;
}

/* Status: Approved / Present */
.badge-approved, .badge-present {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}
.badge-approved::before, .badge-present::before { background-color: #10b981; }
.light-theme .badge-approved, .light-theme .badge-present {
    background: #d1fae5;
    color: #047857;
}

/* Status: Rejected / Absent */
.badge-rejected, .badge-absent {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}
.badge-rejected::before, .badge-absent::before { background-color: #ef4444; }
.light-theme .badge-rejected, .light-theme .badge-absent {
    background: #fee2e2;
    color: #b91c1c;
}

/* Status: Late */
.badge-late {
    background: rgba(245, 158, 11, 0.15);
    color: #f8a032;
}
.badge-late::before { background-color: #d97706; }

/* Status: Sick Leave request */
.badge-sick {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
}
.badge-sick::before { background-color: #06b6d4; }
.light-theme .badge-sick {
    background: #ecfeff;
    color: #0891b2;
}

/* Grade badges */
.badge-grade {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
}

/* ==========================================
   MODAL / POPUP
   ========================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    width: 100%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 30px;
    animation: modalSlideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.light-theme .modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-speed);
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ==========================================
   HELPERS / TABS / UTILITIES
   ========================================== */
.tab-container {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
}
.light-theme .tab-container {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.tab-btn {
    padding: 8px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-speed);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-3 { margin-top: 15px; }
.mt-4 { margin-top: 20px; }
.mb-3 { margin-bottom: 15px; }

/* Attendance grid check */
.attendance-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.attendance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--border-radius-md);
}
.light-theme .attendance-row {
    background: rgba(0, 0, 0, 0.01);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.attendance-student-info {
    display: flex;
    flex-direction: column;
}

.attendance-student-info .name {
    font-weight: 600;
    font-size: 0.95rem;
}

.attendance-student-info .id {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.attendance-options {
    display: flex;
    gap: 5px;
}

.attendance-btn {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition-speed);
}
.light-theme .attendance-btn {
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(0, 0, 0, 0.02);
}

.attendance-btn:hover {
    color: var(--text-primary);
}

.attendance-btn.active[data-status="present"] {
    background: var(--success);
    color: white;
    border-color: var(--success);
}
.attendance-btn.active[data-status="absent"] {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}
.attendance-btn.active[data-status="late"] {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}
.attendance-btn.active[data-status="sick"] {
    background: var(--info);
    color: white;
    border-color: var(--info);
}

/* ==========================================
   RESPONSIVE LAYOUTS
   ========================================== */
/* Mobile menu overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px var(--glass-shadow);
    transition: all var(--transition-speed);
    flex-shrink: 0;
}
.mobile-menu-toggle:hover {
    background: var(--card-hover-bg);
    transform: scale(1.05);
}

@media (max-width: 768px) {
    body {
        display: block !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: auto !important;
        position: relative;
    }
    
    .app-container {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: 100vh;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 280px;
        height: 100vh;
        z-index: 100;
        border-radius: 0 var(--border-radius-lg) var(--border-radius-lg) 0;
        border-right: 1px solid var(--glass-border);
        border-bottom: none;
        transform: translateX(-100%);
        transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    }
    
    .sidebar-brand {
        margin-bottom: 25px;
    }
    
    .sidebar-user {
        margin-bottom: 20px;
    }
    
    .sidebar-menu {
        display: block;
    }
    
    .sidebar-menu li {
        margin-bottom: 8px;
    }
    
    .sidebar-menu a {
        padding: 12px 16px;
        justify-content: flex-start;
        font-size: 0.95rem;
    }
    
    .sidebar-menu li.active a {
        border-left: 4px solid var(--primary-color);
        border-bottom: none;
    }
    
    .main-content {
        padding: 20px 15px;
        width: 100% !important;
        display: block !important;
        height: auto !important;
        min-height: auto !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
    }
    
    .dashboard-grid, .stats-grid, .home-visits-grid, .student-profile-details {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        gap: 15px !important;
    }
    
    .left-column, .right-column, .glass-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
    
    .table-responsive {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    
    .custom-table {
        min-width: 650px !important;
    }
    
    .main-header {
        margin-bottom: 25px;
        flex-wrap: nowrap;
        gap: 12px;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .header-title {
        min-width: 0 !important;
        flex: 1 !important;
    }
    
    .header-title h2 {
        font-size: 1.15rem !important;
        white-space: normal !important;
        line-height: 1.3 !important;
    }
    .header-title p {
        font-size: 0.75rem !important;
        white-space: normal !important;
        line-height: 1.3 !important;
    }
    
    /* Responsive Chat Layout */
    #tab-parent-chat > .glass-card > div {
        flex-direction: column !important;
        height: auto !important;
    }
    
    #tab-parent-chat > .glass-card > div > div:first-child {
        width: 100% !important;
        height: 180px !important;
        border-right: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    }
    
    #tab-parent-chat > .glass-card > div > div:last-child {
        width: 100% !important;
        height: 370px !important;
    }
    
    .login-card {
        padding: 30px 20px;
    }
    
    /* Calendar responsiveness overrides */
    .calendar-day-cell {
        min-height: 60px !important;
        padding: 4px !important;
    }
    .calendar-day-num {
        font-size: 0.8rem !important;
    }
    .calendar-event-item {
        font-size: 0.65rem !important;
        padding: 2px 4px !important;
        margin-top: 1px !important;
    }
    .calendar-header-nav h2 {
        font-size: 1.1rem !important;
    }
}

/* Sidebar Section Title for Grouped Menus */
.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 15px 16px 5px 10px;
    letter-spacing: 0.8px;
    opacity: 0.7;
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}
.light-theme .sidebar-section-title {
    color: var(--text-secondary);
    border-top: 1px solid rgba(0, 0, 0, 0.03);
    opacity: 0.8;
}
@media (max-width: 768px) {
    .sidebar-section-title {
        display: block; /* Keep vertical sections in mobile drawer */
    }
}
