/* ===========================
   MGT AI Learning Platform
   Dual-Theme Design System
   =========================== */

/* ===== LIGHT THEME (Default) ===== */
:root,
[data-theme="light"] {
  --c-primary: #4f46e5;
  --c-primary-light: #6366f1;
  --c-primary-dark: #4338ca;
  --c-primary-glow: rgba(79, 70, 229, 0.2);
  --c-primary-bg: rgba(79, 70, 229, 0.08);

  --c-accent: #0891b2;
  --c-accent-light: #06b6d4;
  --c-accent-glow: rgba(8, 145, 178, 0.2);

  --c-bg: #f8fafc;
  --c-bg-secondary: #f1f5f9;
  --c-bg-card: #ffffff;
  --c-bg-card-hover: #f8fafc;
  --c-bg-input: #ffffff;
  --c-bg-elevated: #ffffff;

  --c-text: #0f172a;
  --c-text-secondary: #475569;
  --c-text-muted: #94a3b8;
  --c-text-inverse: #ffffff;

  --c-border: #e2e8f0;
  --c-border-light: #cbd5e1;

  --c-success: #059669;
  --c-warning: #d97706;
  --c-danger: #dc2626;
  --c-info: #2563eb;

  --g-primary: linear-gradient(135deg, #4f46e5, #7c3aed);
  --g-accent: linear-gradient(135deg, #0891b2, #06b6d4);
  --g-hero: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #1e3a5f 100%);
  --g-card: #ffffff;
  --g-glow: radial-gradient(ellipse at 50% 0%, rgba(79,70,229,0.08) 0%, transparent 70%);

  --sh-sm: 0 1px 3px rgba(0,0,0,0.08);
  --sh-md: 0 4px 12px rgba(0,0,0,0.08);
  --sh-lg: 0 8px 24px rgba(0,0,0,0.1);
  --sh-glow: 0 0 20px var(--c-primary-glow);

  --header-bg: rgba(248, 250, 252, 0.88);
  --modal-backdrop: rgba(15, 23, 42, 0.5);
}

/* ===== DARK BLUE THEME ===== */
[data-theme="dark"] {
  --c-primary: #6366f1;
  --c-primary-light: #818cf8;
  --c-primary-dark: #4f46e5;
  --c-primary-glow: rgba(99, 102, 241, 0.3);
  --c-primary-bg: rgba(99, 102, 241, 0.12);

  --c-accent: #22d3ee;
  --c-accent-light: #67e8f9;
  --c-accent-glow: rgba(34, 211, 238, 0.25);

  --c-bg: #0c0f1d;
  --c-bg-secondary: #111527;
  --c-bg-card: #1a1f36;
  --c-bg-card-hover: #222845;
  --c-bg-input: #151a2e;
  --c-bg-elevated: #1e2440;

  --c-text: #e2e8f0;
  --c-text-secondary: #94a3b8;
  --c-text-muted: #64748b;
  --c-text-inverse: #0f172a;

  --c-border: #2a3050;
  --c-border-light: #363d5c;

  --c-success: #34d399;
  --c-warning: #fbbf24;
  --c-danger: #f87171;
  --c-info: #60a5fa;

  --g-primary: linear-gradient(135deg, #6366f1, #818cf8);
  --g-accent: linear-gradient(135deg, #22d3ee, #67e8f9);
  --g-hero: linear-gradient(135deg, #0c0f1d 0%, #1a1040 40%, #0d2137 100%);
  --g-card: linear-gradient(145deg, #1a1f36, #1e2440);
  --g-glow: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.12) 0%, transparent 70%);

  --sh-sm: 0 2px 8px rgba(0,0,0,0.3);
  --sh-md: 0 4px 16px rgba(0,0,0,0.35);
  --sh-lg: 0 8px 32px rgba(0,0,0,0.45);
  --sh-glow: 0 0 20px var(--c-primary-glow);

  --header-bg: rgba(12, 15, 29, 0.88);
  --modal-backdrop: rgba(0, 0, 0, 0.7);
}

/* ===== CONSTANTS (shared) ===== */
:root {
  --sp-xs: 4px; --sp-sm: 8px; --sp-md: 16px; --sp-lg: 24px;
  --sp-xl: 32px; --sp-2xl: 48px; --sp-3xl: 64px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px; --r-full: 9999px;
  --t-fast: 0.15s ease; --t-normal: 0.25s ease; --t-slow: 0.4s ease;
  --f-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --f-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  --header-h: 64px; --max-w: 1280px; --sidebar-w: 260px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--f-sans); background: var(--c-bg); color: var(--c-text);
  line-height: 1.6; min-height: 100vh; overflow-x: hidden;
  transition: background var(--t-normal), color var(--t-normal);
}
a { color: var(--c-primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--c-primary-dark); }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* --- Utility --- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-danger { color: var(--c-danger) !important; }
.text-success { color: var(--c-success) !important; }
.text-warning { color: var(--c-warning) !important; }
.text-muted { color: var(--c-text-muted) !important; }
.text-primary { color: var(--c-primary) !important; }

/* ===== SVG ICON SYSTEM ===== */
.icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1em; height: 1em; flex-shrink: 0;
}
.icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 28px; height: 28px; }
.icon-xl { width: 36px; height: 36px; }

/* --- Loader --- */
.loader-overlay {
  position: fixed; inset: 0; z-index: 9999; background: var(--c-bg);
  display: flex; align-items: center; justify-content: center; transition: opacity 0.5s ease;
}
.loader-overlay.fade-out { opacity: 0; pointer-events: none; }
.loader-content { text-align: center; }
.loader-logo {
  font-size: 3rem; font-weight: 800;
  background: var(--g-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: 4px; margin-bottom: var(--sp-lg);
}
.loader-bar { width: 200px; height: 3px; background: var(--c-border); border-radius: var(--r-full); overflow: hidden; margin: 0 auto var(--sp-md); }
.loader-bar-fill { height: 100%; width: 0; background: var(--g-primary); border-radius: var(--r-full); animation: loaderFill 1.5s ease forwards; }
.loader-text { color: var(--c-text-secondary); font-size: 0.9rem; }
@keyframes loaderFill { to { width: 100%; } }

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

/* --- Header --- */
.header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); z-index: 100;
  background: var(--header-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--c-border); transition: background var(--t-normal), border-color var(--t-normal);
}
.header-inner {
  max-width: var(--max-w); margin: 0 auto; height: 100%; padding: 0 var(--sp-lg);
  display: flex; align-items: center; gap: var(--sp-lg);
}

/* Logo */
.logo { display: flex; align-items: center; gap: 8px; color: var(--c-text) !important; font-weight: 700; font-size: 1.3rem; white-space: nowrap; }
.logo:hover { color: var(--c-text) !important; }
.logo-mark {
  width: 32px; height: 32px; border-radius: var(--r-md);
  background: var(--g-primary); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-mark svg { width: 18px; height: 18px; fill: #fff; stroke: none; }
.logo-text { font-size: 1.2rem; font-weight: 800; }
.logo-sub { font-size: 0.65rem; font-weight: 400; color: var(--c-text-muted); display: block; line-height: 1; margin-top: 1px; }

/* Nav */
.nav-main { display: flex; gap: 2px; margin-left: var(--sp-xl); }
.nav-link {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px;
  border-radius: var(--r-md); color: var(--c-text-secondary) !important;
  font-size: 0.88rem; font-weight: 500; transition: all var(--t-fast); white-space: nowrap;
}
.nav-link:hover { color: var(--c-text) !important; background: var(--c-primary-bg); }
.nav-link.active { color: var(--c-primary) !important; background: var(--c-primary-bg); font-weight: 600; }
.nav-link .nav-icon { width: 18px; height: 18px; }
.nav-link .nav-icon svg { width: 100%; height: 100%; }

/* Header Actions */
.header-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-md); }

/* Theme Toggle */
.theme-toggle {
  width: 44px; height: 24px; border-radius: 12px; border: 1.5px solid var(--c-border);
  background: var(--c-bg-input); cursor: pointer; position: relative;
  transition: all var(--t-fast); flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--c-primary); }
.theme-toggle-knob {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--g-primary); position: absolute; top: 2px; left: 2px;
  transition: transform var(--t-fast); display: flex; align-items: center; justify-content: center;
}
.theme-toggle-knob svg { width: 10px; height: 10px; fill: #fff; stroke: none; }
[data-theme="dark"] .theme-toggle-knob { transform: translateX(20px); }

/* Search */
.search-box { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 10px; pointer-events: none; width: 16px; height: 16px; }
.search-icon svg { width: 100%; height: 100%; }
.search-box input {
  width: 220px; padding: 8px 12px 8px 34px;
  background: var(--c-bg-input); border: 1px solid var(--c-border);
  border-radius: var(--r-full); color: var(--c-text); font-size: 0.85rem; outline: none;
  transition: all var(--t-fast);
}
.search-box input:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-glow); width: 280px; }
.search-box input::placeholder { color: var(--c-text-muted); }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--c-bg-elevated); border: 1px solid var(--c-border);
  border-radius: var(--r-md); max-height: 400px; overflow-y: auto;
  box-shadow: var(--sh-lg); display: none; z-index: 50;
}
.search-results.show { display: block; }
.search-result-item { padding: var(--sp-md); cursor: pointer; border-bottom: 1px solid var(--c-border); transition: background var(--t-fast); }
.search-result-item:hover { background: var(--c-bg-card-hover); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item h4 { font-size: 0.9rem; margin-bottom: 4px; }
.search-result-item p { font-size: 0.8rem; color: var(--c-text-muted); }

/* User Avatar */
.user-avatar-wrap { position: relative; }
.user-avatar {
  width: 36px; height: 36px; border-radius: var(--r-full); background: var(--g-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: #fff; cursor: pointer;
  transition: box-shadow var(--t-fast);
}
.user-avatar:hover { box-shadow: 0 0 0 3px var(--c-primary-glow); }

/* Dropdown */
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 200px;
  background: var(--c-bg-elevated); border: 1px solid var(--c-border);
  border-radius: var(--r-md); box-shadow: var(--sh-lg);
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: all var(--t-fast); z-index: 60;
}
.dropdown-menu.show { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-header { padding: var(--sp-md); border-bottom: 1px solid var(--c-border); font-weight: 600; font-size: 0.9rem; color: var(--c-primary); }
.dropdown-item { display: flex; align-items: center; gap: 8px; padding: var(--sp-sm) var(--sp-md); color: var(--c-text) !important; font-size: 0.9rem; transition: background var(--t-fast); }
.dropdown-item:hover { background: var(--c-primary-bg); color: var(--c-text) !important; }
.dropdown-item .icon { width: 16px; height: 16px; }
.dropdown-divider { height: 1px; background: var(--c-border); margin: var(--sp-xs) 0; }

/* Auth buttons */
.auth-buttons { display: flex; gap: var(--sp-sm); }

/* Mobile menu */
.mobile-menu-btn { display: none; background: none; border: none; color: var(--c-text); cursor: pointer; padding: 4px; }
.mobile-menu-btn svg { width: 24px; height: 24px; }
.mobile-sidebar {
  position: fixed; top: 0; left: -280px; width: 280px; height: 100vh; z-index: 200;
  background: var(--c-bg-secondary); border-right: 1px solid var(--c-border); transition: left var(--t-normal); overflow-y: auto;
}
.mobile-sidebar.open { left: 0; }
.mobile-sidebar-header { padding: var(--sp-lg); border-bottom: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 1.2rem; }
.mobile-sidebar-close { background: none; border: none; color: var(--c-text); font-size: 1.2rem; cursor: pointer; }
.mobile-nav { padding: var(--sp-md); }
.mobile-nav a { display: flex; align-items: center; gap: var(--sp-sm); padding: var(--sp-md); color: var(--c-text-secondary) !important; border-radius: var(--r-md); transition: all var(--t-fast); }
.mobile-nav a:hover, .mobile-nav a.active { background: var(--c-primary-bg); color: var(--c-primary) !important; }
.mobile-overlay { position: fixed; inset: 0; z-index: 199; background: rgba(0,0,0,0.5); opacity: 0; visibility: hidden; transition: all var(--t-normal); }
.mobile-overlay.show { opacity: 1; visibility: visible; }

/* --- Main Content --- */
.main-content { flex: 1; margin-top: var(--header-h); padding: var(--sp-xl) var(--sp-lg); max-width: var(--max-w); width: 100%; margin-left: auto; margin-right: auto; }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border: none; border-radius: var(--r-md); font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: all var(--t-fast); white-space: nowrap; text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-primary { background: var(--g-primary); color: #fff; box-shadow: 0 2px 12px var(--c-primary-glow); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--c-primary-glow); color: #fff; }
.btn-accent { background: var(--g-accent); color: #fff; box-shadow: 0 2px 12px var(--c-accent-glow); }
.btn-accent:hover { transform: translateY(-1px); color: #fff; }
.btn-ghost { background: transparent; color: var(--c-text); border: 1px solid var(--c-border); }
.btn-ghost:hover { border-color: var(--c-primary); background: var(--c-primary-bg); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-block { width: 100%; }

/* --- Cards --- */
.card {
  background: var(--c-bg-card); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); padding: var(--sp-lg); transition: all var(--t-normal);
}
.card:hover { border-color: var(--c-primary); box-shadow: var(--sh-glow); transform: translateY(-2px); }

/* Course Card */
.course-card { overflow: hidden; cursor: pointer; padding: 0; }
.course-card-img {
  height: 160px; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.course-card-img .cover-pattern { position: absolute; inset: 0; opacity: 0.15; }
.course-card-img .cover-icon { position: relative; z-index: 1; }
.course-card-img .cover-icon svg { width: 48px; height: 48px; fill: rgba(255,255,255,0.9); stroke: none; }
.course-card-badge {
  position: absolute; top: var(--sp-sm); right: var(--sp-sm);
  padding: 4px 10px; background: rgba(255,255,255,0.2); color: #fff;
  backdrop-filter: blur(8px); border-radius: var(--r-full); font-size: 0.72rem; font-weight: 600;
}
.course-card-body { padding: var(--sp-lg); }
.course-card-title { font-size: 1rem; font-weight: 700; margin-bottom: var(--sp-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.course-card-meta { display: flex; gap: var(--sp-md); font-size: 0.8rem; color: var(--c-text-muted); margin-bottom: var(--sp-sm); align-items: center; }
.course-card-meta .icon { width: 14px; height: 14px; color: var(--c-text-muted); }
.course-card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: var(--sp-sm); border-top: 1px solid var(--c-border); margin-top: var(--sp-sm); }
.course-card-price { font-weight: 700; color: var(--c-accent); font-size: 1.05rem; }
.course-card-rating { font-size: 0.85rem; color: var(--c-warning); display: flex; align-items: center; gap: 4px; }
.course-card-rating .icon { width: 14px; height: 14px; }

/* --- Forms --- */
.form-group { margin-bottom: var(--sp-lg); }
.form-label { display: block; margin-bottom: var(--sp-sm); font-weight: 600; font-size: 0.9rem; color: var(--c-text-secondary); }
.form-input, .form-select, .form-textarea { width: 100%; padding: 12px var(--sp-md); background: var(--c-bg-input); border: 1px solid var(--c-border); border-radius: var(--r-md); color: var(--c-text); font-size: 0.95rem; outline: none; transition: all var(--t-fast); }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-glow); }
.form-input::placeholder { color: var(--c-text-muted); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-select { appearance: none; cursor: pointer; }
.form-error { font-size: 0.8rem; color: var(--c-danger); margin-top: var(--sp-xs); }

/* --- Badges / Tags --- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-full); font-size: 0.72rem; font-weight: 600; }
.badge-primary { background: var(--c-primary-bg); color: var(--c-primary); }
.badge-accent { background: rgba(8,145,178,0.1); color: var(--c-accent); }
.badge-success { background: rgba(5,150,105,0.1); color: var(--c-success); }
.badge-warning { background: rgba(217,119,6,0.1); color: var(--c-warning); }
.badge-danger { background: rgba(220,38,38,0.1); color: var(--c-danger); }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; background: var(--c-bg-card); border: 1px solid var(--c-border); border-radius: var(--r-full); font-size: 0.82rem; color: var(--c-text-secondary); cursor: pointer; transition: all var(--t-fast); }
.tag:hover, .tag.active { border-color: var(--c-primary); color: var(--c-primary); background: var(--c-primary-bg); }
.tag .icon { width: 14px; height: 14px; }

/* --- Progress Bar --- */
.progress-bar { width: 100%; height: 8px; background: var(--c-border); border-radius: var(--r-full); overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: var(--r-full); background: var(--g-primary); transition: width var(--t-slow); }

/* --- Stats Card --- */
.stat-card { text-align: center; padding: var(--sp-lg); }
.stat-card-icon { width: 40px; height: 40px; margin: 0 auto var(--sp-sm); border-radius: var(--r-md); background: var(--c-primary-bg); display: flex; align-items: center; justify-content: center; }
.stat-card-icon svg { width: 22px; height: 22px; }
.stat-card-value { font-size: 2rem; font-weight: 800; background: var(--g-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat-card-label { font-size: 0.85rem; color: var(--c-text-muted); margin-top: var(--sp-xs); }

/* --- Table --- */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--c-border); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: var(--sp-md); text-align: left; border-bottom: 1px solid var(--c-border); }
th { background: var(--c-bg-secondary); font-weight: 600; color: var(--c-text-secondary); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover td { background: var(--c-primary-bg); }
tr:last-child td { border-bottom: none; }

/* --- Tabs --- */
.tabs { display: flex; gap: var(--sp-xs); border-bottom: 2px solid var(--c-border); margin-bottom: var(--sp-xl); }
.tab-btn { padding: var(--sp-sm) var(--sp-lg); background: none; border: none; color: var(--c-text-muted); font-weight: 600; font-size: 0.9rem; cursor: pointer; position: relative; transition: color var(--t-fast); }
.tab-btn:hover { color: var(--c-text); }
.tab-btn.active { color: var(--c-primary); }
.tab-btn.active::after { content: ''; position: absolute; bottom: -2px; left: 0; right: 0; height: 2px; background: var(--g-primary); border-radius: 2px; }

/* --- Hero Section --- */
.hero { position: relative; padding: var(--sp-3xl) var(--sp-xl); background: var(--g-hero); border-radius: var(--r-xl); overflow: hidden; margin-bottom: var(--sp-2xl); }
.hero::before { content: ''; position: absolute; inset: 0; background: var(--g-glow); pointer-events: none; }
.hero::after { content: ''; position: absolute; right: -40px; top: -40px; width: 300px; height: 300px; border-radius: 50%; background: rgba(255,255,255,0.03); }
.hero-content { position: relative; z-index: 1; max-width: 640px; }
.hero-title { font-size: 2.8rem; font-weight: 800; line-height: 1.2; margin-bottom: var(--sp-lg); color: #fff; }
.hero-title .highlight { background: linear-gradient(135deg, #a5b4fc, #818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-desc { font-size: 1.05rem; color: rgba(255,255,255,0.75); margin-bottom: var(--sp-xl); line-height: 1.8; }
.hero-actions { display: flex; gap: var(--sp-md); flex-wrap: wrap; }

/* Hero decorative SVG */
.hero-decor { position: absolute; right: 40px; top: 50%; transform: translateY(-50%); opacity: 0.12; }
.hero-decor svg { width: 280px; height: 280px; stroke: #fff; fill: none; stroke-width: 1; }

/* --- Grid Layouts --- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-lg); }

/* --- Section --- */
.section { margin-bottom: var(--sp-2xl); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-lg); }
.section-title { font-size: 1.5rem; font-weight: 700; }
.section-more { font-size: 0.9rem; color: var(--c-primary); display: flex; align-items: center; gap: 4px; }

/* --- Auth Pages --- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - var(--header-h) - 100px); }
.auth-card { width: 100%; max-width: 440px; background: var(--c-bg-card); border: 1px solid var(--c-border); border-radius: var(--r-xl); padding: var(--sp-2xl); box-shadow: var(--sh-lg); }
.auth-logo { width: 56px; height: 56px; border-radius: var(--r-lg); background: var(--g-primary); margin: 0 auto var(--sp-lg); display: flex; align-items: center; justify-content: center; }
.auth-logo svg { width: 32px; height: 32px; fill: #fff; stroke: none; }
.auth-title { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: var(--sp-sm); }
.auth-subtitle { text-align: center; color: var(--c-text-muted); margin-bottom: var(--sp-xl); font-size: 0.9rem; }
.auth-footer { text-align: center; margin-top: var(--sp-lg); font-size: 0.9rem; color: var(--c-text-muted); }

/* --- Profile --- */
.profile-header { display: flex; gap: var(--sp-xl); align-items: center; padding: var(--sp-2xl); background: var(--c-bg-card); border-radius: var(--r-xl); border: 1px solid var(--c-border); margin-bottom: var(--sp-xl); }
.profile-avatar { width: 100px; height: 100px; border-radius: var(--r-full); background: var(--g-primary); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.profile-info h2 { font-size: 1.5rem; margin-bottom: var(--sp-xs); }

/* --- AI Chat --- */
.ai-fab {
  position: fixed; bottom: 24px; right: 24px; width: 52px; height: 52px;
  background: var(--g-primary); border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 80; box-shadow: 0 4px 20px var(--c-primary-glow); transition: transform var(--t-fast); border: none;
}
.ai-fab:hover { transform: scale(1.08); }
.ai-fab svg { width: 24px; height: 24px; fill: #fff; stroke: none; }
.ai-fab-pulse { position: absolute; inset: -4px; border-radius: var(--r-full); border: 2px solid var(--c-primary); animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.3); opacity: 0; } }

.ai-chat-panel { position: fixed; bottom: 88px; right: 24px; width: 380px; height: 520px; background: var(--c-bg-secondary); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--sh-lg); display: flex; flex-direction: column; z-index: 90; animation: slideUp 0.3s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.ai-chat-header { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-md) var(--sp-lg); border-bottom: 1px solid var(--c-border); background: var(--c-bg-elevated); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.ai-chat-title { display: flex; align-items: center; gap: var(--sp-sm); }
.ai-chat-avatar { width: 32px; height: 32px; border-radius: var(--r-full); background: var(--g-primary); display: flex; align-items: center; justify-content: center; }
.ai-chat-avatar svg { width: 18px; height: 18px; fill: #fff; stroke: none; }
.ai-chat-title small { display: block; color: var(--c-success); font-size: 0.75rem; }
.ai-chat-close { background: none; border: none; color: var(--c-text-muted); font-size: 1.2rem; cursor: pointer; }
.ai-chat-messages { flex: 1; overflow-y: auto; padding: var(--sp-md); display: flex; flex-direction: column; gap: var(--sp-md); }
.chat-msg { display: flex; gap: var(--sp-sm); max-width: 85%; }
.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-bubble { padding: var(--sp-md); border-radius: var(--r-md); font-size: 0.9rem; line-height: 1.6; }
.chat-msg.bot .chat-bubble { background: var(--c-bg-elevated); border: 1px solid var(--c-border); }
.chat-msg.user .chat-bubble { background: var(--g-primary); color: #fff; }
.ai-chat-input { display: flex; gap: var(--sp-sm); padding: var(--sp-md); border-top: 1px solid var(--c-border); }
.ai-chat-input input { flex: 1; padding: 10px var(--sp-md); background: var(--c-bg-input); border: 1px solid var(--c-border); border-radius: var(--r-md); color: var(--c-text); outline: none; }
.ai-chat-input input:focus { border-color: var(--c-primary); }

/* --- Course Detail --- */
.course-detail-hero { padding: var(--sp-2xl); background: var(--g-hero); border-radius: var(--r-xl); margin-bottom: var(--sp-xl); position: relative; overflow: hidden; }
.course-detail-hero::before { content: ''; position: absolute; inset: 0; background: var(--g-glow); pointer-events: none; }
.course-detail-hero > * { position: relative; z-index: 1; }
.course-detail-title { font-size: 2rem; font-weight: 800; margin-bottom: var(--sp-md); color: #fff; }
.course-detail-meta { display: flex; gap: var(--sp-lg); flex-wrap: wrap; font-size: 0.9rem; color: rgba(255,255,255,0.75); margin-bottom: var(--sp-lg); }
.course-detail-desc-light { color: rgba(255,255,255,0.7); max-width: 640px; margin-bottom: var(--sp-xl); }
.course-detail-actions { display: flex; gap: var(--sp-md); }

/* Lesson List */
.lesson-item { display: flex; align-items: center; gap: var(--sp-md); padding: var(--sp-md) var(--sp-lg); border: 1px solid var(--c-border); border-radius: var(--r-md); margin-bottom: var(--sp-sm); cursor: pointer; transition: all var(--t-fast); }
.lesson-item:hover { border-color: var(--c-primary); background: var(--c-primary-bg); }
.lesson-item.completed { border-color: var(--c-success); }
.lesson-item.completed .lesson-status { color: var(--c-success); }
.lesson-status { flex-shrink: 0; }
.lesson-status svg { width: 18px; height: 18px; }
.lesson-title { flex: 1; font-size: 0.95rem; }
.lesson-duration { color: var(--c-text-muted); font-size: 0.85rem; }

/* --- Admin --- */
.admin-layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; gap: var(--sp-xl); min-height: calc(100vh - var(--header-h) - 100px); }
.admin-sidebar { background: var(--c-bg-card); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--sp-lg); height: fit-content; position: sticky; top: calc(var(--header-h) + var(--sp-xl)); }
.admin-sidebar-title { font-size: 0.82rem; font-weight: 700; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: var(--sp-md); padding: 0 var(--sp-sm); }
.admin-nav-item { display: flex; align-items: center; gap: var(--sp-sm); padding: var(--sp-sm) var(--sp-md); border-radius: var(--r-md); color: var(--c-text-secondary) !important; font-size: 0.9rem; cursor: pointer; transition: all var(--t-fast); margin-bottom: 2px; }
.admin-nav-item:hover { background: var(--c-primary-bg); color: var(--c-text) !important; }
.admin-nav-item.active { background: var(--c-primary-bg); color: var(--c-primary) !important; font-weight: 600; }
.admin-nav-item .icon { width: 16px; height: 16px; }
.admin-content { min-width: 0; }

/* --- Footer --- */
.footer { margin-top: var(--sp-3xl); background: var(--c-bg-secondary); border-top: 1px solid var(--c-border); transition: background var(--t-normal), border-color var(--t-normal); }
.footer-inner { max-width: var(--max-w); margin: 0 auto; padding: var(--sp-2xl) var(--sp-lg); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--sp-2xl); margin-bottom: var(--sp-2xl); }
.footer-logo { font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: var(--sp-sm); margin-bottom: var(--sp-md); }
.footer-desc { color: var(--c-text-muted); font-size: 0.9rem; line-height: 1.7; }
.footer-col h4 { color: var(--c-text); font-size: 0.9rem; margin-bottom: var(--sp-md); }
.footer-col a { display: block; color: var(--c-text-muted) !important; font-size: 0.85rem; margin-bottom: var(--sp-sm); transition: color var(--t-fast); }
.footer-col a:hover { color: var(--c-primary) !important; }
.footer-bottom { padding-top: var(--sp-lg); border-top: 1px solid var(--c-border); text-align: center; color: var(--c-text-muted); font-size: 0.82rem; }

/* --- Toast --- */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: var(--sp-sm); }
.toast { padding: var(--sp-md) var(--sp-lg); background: var(--c-bg-elevated); border: 1px solid var(--c-border); border-radius: var(--r-md); box-shadow: var(--sh-lg); min-width: 280px; display: flex; align-items: center; gap: var(--sp-sm); font-size: 0.9rem; animation: slideIn 0.3s ease; }
.toast.success { border-left: 4px solid var(--c-success); }
.toast.error { border-left: 4px solid var(--c-danger); }
.toast.warning { border-left: 4px solid var(--c-warning); }
.toast.info { border-left: 4px solid var(--c-info); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* --- Modal --- */
.modal-overlay { position: fixed; inset: 0; z-index: 200; background: var(--modal-backdrop); display: flex; align-items: center; justify-content: center; padding: var(--sp-lg); }
.modal-content { background: var(--c-bg-elevated); border: 1px solid var(--c-border); border-radius: var(--r-xl); max-width: 560px; width: 100%; max-height: 80vh; overflow-y: auto; padding: var(--sp-2xl); animation: modalIn 0.3s ease; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-xl); }
.modal-title { font-size: 1.3rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--c-text-muted); font-size: 1.5rem; cursor: pointer; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; }
}
@media (max-width: 768px) {
  .nav-main { display: none; }
  .mobile-menu-btn { display: block; }
  .search-box input { width: 160px; }
  .search-box input:focus { width: 200px; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.8rem; }
  .hero { padding: var(--sp-xl); }
  .hero-decor { display: none; }
  .profile-header { flex-direction: column; text-align: center; }
  .footer-grid { grid-template-columns: 1fr; }
  .ai-chat-panel { width: calc(100vw - 32px); right: 16px; bottom: 80px; height: 400px; }
  .theme-toggle { display: none; }
}
@media (max-width: 480px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.5rem; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .auth-card { padding: var(--sp-lg); }
  .search-box { display: none; }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--c-bg); }
::-webkit-scrollbar-thumb { background: var(--c-border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-primary); }

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.fade-in { animation: fadeIn 0.5s ease; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.fade-in-up { animation: fadeInUp 0.5s ease; }
.stagger-children > * { opacity: 0; animation: fadeInUp 0.4s ease forwards; }
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(n+11) { animation-delay: 0.55s; }

/* --- Empty State --- */
.empty-state { text-align: center; padding: var(--sp-3xl); color: var(--c-text-muted); }
.empty-state-icon { width: 64px; height: 64px; margin: 0 auto var(--sp-lg); background: var(--c-primary-bg); border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center; }
.empty-state-icon svg { width: 32px; height: 32px; }
.empty-state-title { font-size: 1.2rem; margin-bottom: var(--sp-sm); color: var(--c-text-secondary); }
.empty-state-desc { font-size: 0.9rem; max-width: 400px; margin: 0 auto; }

/* --- Learning Path --- */
.path-card { position: relative; padding-left: var(--sp-xl); }
.path-card::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--c-border); }
.path-step { position: relative; padding: var(--sp-lg); background: var(--c-bg-card); border: 1px solid var(--c-border); border-radius: var(--r-md); margin-bottom: var(--sp-md); }
.path-step::before { content: ''; position: absolute; left: -20px; top: 50%; width: 12px; height: 12px; background: var(--c-primary); border-radius: var(--r-full); transform: translateY(-50%); border: 2px solid var(--c-bg); }
.path-step.completed::before { background: var(--c-success); }
