@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

:root {
    --bg-canvas: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-subtle: #f8fafc;
    --sidebar-bg: #0f172a;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --accent-primary: #4f46e5;
    --accent-primary-hover: #4338ca;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 20px 40px -15px rgba(15, 23, 42, 0.14);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .brand-font {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 20%, rgba(79, 70, 229, 0.16), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(14, 165, 233, 0.14), transparent 45%),
        #0f172a;
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-brand-badge {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--sidebar-active);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.35);
}

/* ==================== APP SHELL & SIDEBAR ==================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ==================== PREMIUM SIDEBAR ==================== */
.sidebar {
    width: 274px;
    min-width: 274px;
    background: #0b1120;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1040;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(79, 70, 229, 0.12) 0%, rgba(11, 17, 32, 0) 100%);
}

.sidebar-brand-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
    flex-shrink: 0;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px 18px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 5px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.22);
    border-radius: 999px;
}

.sidebar-section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #64748b;
    padding: 16px 12px 6px;
}

.sidebar-section-label:first-child {
    padding-top: 4px;
}

.sidebar .nav {
    gap: 3px;
}

.sidebar .nav-link,
.sidebar .sidebar-toggle {
    width: 100%;
    background: transparent;
    border: 0;
    color: #94a3b8;
    font-weight: 500;
    font-size: 0.885rem;
    padding: 10px 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    text-decoration: none;
    transition: all 0.18s ease;
    cursor: pointer;
}

.sidebar .nav-left {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.sidebar .nav-left i {
    font-size: 1.05rem;
    color: #64748b;
    transition: color 0.18s ease;
    flex-shrink: 0;
}

.sidebar .nav-link:hover,
.sidebar .sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
}

.sidebar .nav-link:hover i,
.sidebar .sidebar-toggle:hover i {
    color: #93c5fd;
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.35);
}

.sidebar .nav-link.active i {
    color: #ffffff;
}

.sidebar .sidebar-toggle.parent-active {
    color: #e2e8f0;
    background: rgba(79, 70, 229, 0.14);
}

.sidebar .sidebar-toggle.parent-active i.menu-icon {
    color: #818cf8;
}

.sidebar .chevron-icon {
    font-size: 0.8rem;
    color: #64748b;
    transition: transform 0.22s ease;
}

.sidebar .sidebar-toggle[aria-expanded="true"] .chevron-icon {
    transform: rotate(180deg);
    color: #cbd5e1;
}

/* Submenu Styling */
.sidebar-submenu {
    padding: 4px 0 6px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-submenu .nav-link {
    padding: 8px 12px 8px 16px;
    font-size: 0.84rem;
    color: #94a3b8;
    position: relative;
}

.sidebar-submenu .nav-link::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #475569;
    transition: all 0.18s ease;
}

.sidebar-submenu .nav-link:hover::before {
    background: #93c5fd;
}

.sidebar-submenu .nav-link.active {
    background: rgba(79, 70, 229, 0.18);
    color: #ffffff;
    box-shadow: none;
    font-weight: 600;
}

.sidebar-submenu .nav-link.active::before {
    background: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}

.nav-pill-tag {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    color: #94a3b8;
}

.nav-pill-tag.live {
    background: rgba(16, 185, 129, 0.16);
    color: #34d399;
}

/* Sidebar Footer Profile */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.75);
}

.sidebar-user-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sidebar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.65);
    backdrop-filter: blur(3px);
    z-index: 1035;
}

.sidebar-backdrop.show {
    display: block;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
}

/* ==================== MAIN CONTENT & TOPBAR ==================== */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 28px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.content-container {
    padding: 28px;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

/* ==================== CARDS & METRICS ==================== */
.premium-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.stat-icon-box {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    flex-shrink: 0;
}

.icon-indigo { background: rgba(79, 70, 229, 0.1); color: #4f46e5; }
.icon-emerald { background: rgba(16, 185, 129, 0.12); color: #059669; }
.icon-amber { background: rgba(245, 158, 11, 0.12); color: #d97706; }

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.15;
    margin: 4px 0 6px;
}

.session-pill {
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 999px;
}

/* ==================== BUTTONS, FORMS & MODALS ==================== */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.18s ease;
}

.btn-primary {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--accent-primary-hover);
    border-color: var(--accent-primary-hover);
    transform: translateY(-1px);
}

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid #cbd5e1;
    padding: 9px 12px;
    font-size: 0.9rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14);
}

.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 18px 24px;
    background: var(--bg-subtle);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

.modal-body {
    padding: 22px 24px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 14px 24px;
    background: var(--bg-subtle);
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

/* ==================== TABLES & AVATARS ==================== */
.student-avatar {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
}

.adm-badge {
    background: #eef2ff;
    color: #4338ca;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 4px 9px;
    border-radius: 6px;
}

.table thead th {
    background-color: var(--bg-subtle) !important;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 12px 14px;
}

.table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table-hover tbody tr:hover td {
    background-color: #f8fafc;
}

/* ==================== RESPONSIVE MOBILE DRAWER ==================== */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .topbar {
        padding: 12px 16px;
    }
    .content-container {
        padding: 18px 14px;
    }
}