:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1a1b3a;
    --sidebar-bg-2: #232454;
    --sidebar-hover: #2d2f6b;
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --accent: #f59e0b;
    --accent-soft: #fef3c7;
    --ink: #1e1b3a;
    --muted: #6b7089;
    --surface: #ffffff;
    --canvas: #f6f6fb;
    --border-soft: #ecebf5;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --radius: 14px;
    --radius-sm: 10px;
    --font-display: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
    --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
    background: var(--canvas);
    font-family: var(--font-body);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .page-header h4, .sidebar-brand {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
}

/* ---------- Class color-tag system (signature element) ----------
   Each class gets a consistent color across the app (avatars, badges,
   timetable blocks) so users learn to recognize classes at a glance
   instead of reading text every time. */
.class-tag-0 { --tag: #4f46e5; } .class-tag-1 { --tag: #0891b2; }
.class-tag-2 { --tag: #db2777; } .class-tag-3 { --tag: #ea580c; }
.class-tag-4 { --tag: #16a34a; } .class-tag-5 { --tag: #7c3aed; }
.class-tag-6 { --tag: #ca8a04; } .class-tag-7 { --tag: #0d9488; }
.class-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
    background: color-mix(in srgb, var(--tag) 12%, white);
    color: var(--tag);
}
.class-badge::before {
    content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--tag);
}

/* ---------- Login Pages ---------- */
.login-page {
    display:flex; align-items:center; justify-content:center; min-height:100vh;
    background: radial-gradient(circle at 20% 20%, #4f46e5 0%, #1a1b3a 55%, #100f24 100%);
    font-family: var(--font-body);
}
.login-wrapper { width:100%; max-width:420px; padding:15px; }
.login-card { border:none; border-radius:20px; box-shadow: 0 20px 60px rgba(16, 15, 36, 0.35); }
.login-card .fa-graduation-cap { color: var(--primary); }
.login-card h4 { font-family: var(--font-display); font-weight: 700; }

/* ---------- App Layout ---------- */
.app-wrapper { display:flex; min-height:100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    color:#c8c9e8;
    flex-shrink:0;
    position: sticky;
    top:0;
    height:100vh;
    overflow-y:auto;
    scrollbar-width: thin;
    transition: width .2s ease;
}
.sidebar-brand {
    padding:22px 20px; font-weight:700; color:#fff; font-size:16px;
    border-bottom:1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; gap: 10px;
    white-space: nowrap; overflow: hidden;
}
.sidebar-brand i { color: var(--accent); font-size: 20px; flex-shrink: 0; }
.sidebar-nav { padding:14px 10px; }
.sidebar-nav a {
    display:flex; align-items:center; gap:11px; padding:10px 14px; margin-bottom: 2px;
    color:#b6b8dc; text-decoration:none; font-size:13.5px; font-weight: 500;
    border-radius: var(--radius-sm); transition: background .15s, color .15s;
    white-space: nowrap; overflow: hidden;
}
.sidebar-nav a i { width: 18px; text-align: center; opacity: .85; flex-shrink: 0; }
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color:#fff; }
.sidebar-nav a.active { background: var(--primary); color:#fff; box-shadow: 0 4px 14px rgba(79,70,229,.4); }
.nav-heading {
    padding:16px 14px 6px; text-transform:uppercase; font-size:10.5px; font-weight: 700;
    letter-spacing:.08em; color:#7376a8; white-space: nowrap; overflow: hidden;
}

/* Collapsible sidebar dropdown sections (admin) */
.nav-section { margin-bottom: 2px; }
.nav-section-toggle {
    width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px 14px;
    background: none; border: none; color: #b6b8dc; font-size: 13.5px; font-weight: 600;
    border-radius: var(--radius-sm); cursor: pointer; text-align: left;
}
.nav-section-toggle:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-section-toggle i:first-child { width: 18px; text-align: center; opacity: .85; }
.nav-section-toggle span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toggle-caret { font-size: 10px; opacity: .6; transition: transform .2s; flex-shrink: 0; }
.nav-section-toggle[aria-expanded="true"] .toggle-caret { transform: rotate(180deg); }
.nav-section-toggle[aria-expanded="true"] { color: #fff; }
.nav-section .collapse a, .nav-section .collapsing a { padding-left: 34px; font-size: 13px; }

.sidebar.collapsed .nav-section-toggle span,
.sidebar.collapsed .toggle-caret { display: none; }
.sidebar.collapsed .nav-section-toggle { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-section .collapse a { padding-left: 12px; }

/* Collapsed (icon-only) sidebar state, desktop only */
.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .sidebar-nav a span,
.sidebar.collapsed .nav-heading { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 22px 10px; }
.sidebar.collapsed .sidebar-nav a { justify-content: center; padding: 12px; position: relative; }
.sidebar.collapsed .sidebar-nav a i { width: auto; font-size: 16px; }
.sidebar.collapsed .nav-heading { padding: 14px 0 4px; text-align: center; }
.sidebar.collapsed .nav-heading::after { content: '\2022'; }
.sidebar.collapsed .sidebar-nav a:hover::after {
    content: attr(data-label); position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
    background: #1e1b3a; color: #fff; padding: 6px 12px; border-radius: 6px; font-size: 12.5px;
    white-space: nowrap; margin-left: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 1100;
}
#sidebarCollapseBtn { cursor: pointer; }

.main-area { flex:1; display:flex; flex-direction:column; min-width:0; }
.topbar {
    background:var(--surface); padding:14px 24px; display:flex; align-items:center; justify-content:space-between;
    border-bottom: 1px solid var(--border-soft); position:sticky; top:0; z-index:10;
}
.topbar h5 { font-family: var(--font-display); font-weight: 700; }
.avatar-sm { width:34px; height:34px; border-radius:50%; object-fit:cover; border: 2px solid var(--border-soft); }
.page-content { padding:26px; flex:1; }
.page-footer { text-align:center; padding:16px; color:#9295b8; font-size:12.5px; }
.sys-credit-link { color:#9295b8; text-decoration:none; }
.sys-credit-link:hover { color:#4f46e5; text-decoration:underline; }
.page-header { margin-bottom:20px; display:flex; align-items:center; justify-content:space-between; }
.page-header h4 { font-weight: 700; margin: 0; }

.related-pages-bar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px;
    padding: 10px 14px; background: #f6f6fd; border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
}
.related-pages-label { font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; margin-right: 2px; }
.related-page-link {
    font-size: 12.5px; font-weight: 600; color: var(--primary); text-decoration: none;
    background: #fff; border: 1px solid #e2e2f3; padding: 5px 11px; border-radius: 20px; transition: background .15s, color .15s;
    white-space: nowrap;
}
.related-page-link:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.related-page-link i { margin-right: 4px; }

.card {
    border:none; border-radius:var(--radius); box-shadow: 0 1px 2px rgba(30,27,58,.04), 0 8px 24px rgba(30,27,58,.04);
}
.stat-card {
    border-radius:var(--radius); color:#fff; padding:22px; position: relative; overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.stat-card::after {
    content: ''; position: absolute; right: -20px; top: -20px; width: 100px; height: 100px;
    border-radius: 50%; background: rgba(255,255,255,0.08);
}
.stat-card .stat-icon-badge {
    width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.18);
    display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 10px;
}
.stat-card h3 { margin:4px 0 0; font-size:30px; font-family: var(--font-display); font-weight: 700; }
.stat-card span { opacity:.9; font-size:12.5px; font-weight: 500; }

.btn { border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.form-control, .form-select { border-radius: var(--radius-sm); border-color: var(--border-soft); font-size: 14px; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.form-label { font-weight: 600; font-size: 13px; color: var(--muted); }

.modal-content { border-radius: var(--radius); border: none; }
.badge { font-weight: 600; border-radius: 6px; }

table.dataTable td, table.dataTable th { vertical-align: middle; }
.table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom-width: 1px; }

@media (max-width: 991px) {
    .sidebar { position:fixed; left:-270px; z-index:1050; transition:.25s; }
    .sidebar.show { left:0; }
}

