@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #6c63ff;
  --primary-dark: #4c46b6;
  --secondary: #f59e0b;
  --bg-dark: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card2: #16213e;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #2d2d4e;
  --success: #10b981;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(108,99,255,0.15);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ── NAV ── */
.navbar {
  background: rgba(26,26,46,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 999;
}
.navbar .brand {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a {
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  transition: color .2s;
}
.nav-links a:hover { color: var(--text); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.4rem;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: .9rem;
  transition: all .25s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff;
  box-shadow: 0 4px 18px rgba(108,99,255,.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(108,99,255,.5); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: .4rem 1rem; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

/* ── FORMS ── */
.form-group { margin-bottom: 1.2rem; }
.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.form-control {
  width: 100%;
  background: var(--bg-dark);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .75rem 1rem;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: .95rem;
  transition: border-color .2s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control option { background: var(--bg-card); }

/* ── HERO ── */
.hero {
  min-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(108,99,255,.25) 0%, transparent 70%);
  top: -150px; left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.2rem;
}
.hero h1 span {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

/* ── GRADES GRID ── */
.grades-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  padding: 2rem;
  max-width: 1100px;
  margin: 0 auto;
}
.grade-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all .3s;
  position: relative;
  overflow: hidden;
}
.grade-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(108,99,255,.1), transparent);
  opacity: 0;
  transition: opacity .3s;
}
.grade-card:hover { transform: translateY(-6px); border-color: var(--primary); box-shadow: var(--shadow); }
.grade-card:hover::before { opacity: 1; }
.grade-card .grade-num {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.grade-card .grade-label { font-size: .85rem; color: var(--text-muted); margin-top: .3rem; font-weight: 500; }

/* ── SECTION ── */
.section { padding: 4rem 2rem; max-width: 1100px; margin: 0 auto; }
.section-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.section-title span { color: var(--primary); }

/* ── LESSONS GRID ── */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}
.lesson-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all .3s;
}
.lesson-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--primary); }
.lesson-thumb {
  background: linear-gradient(135deg, var(--primary-dark), #8b5cf6);
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  position: relative;
}
.lesson-thumb .lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  gap: .5rem;
}
.lesson-body { padding: 1.25rem; }
.lesson-body h3 { font-size: 1rem; font-weight: 700; margin-bottom: .4rem; }
.lesson-body p { font-size: .85rem; color: var(--text-muted); line-height: 1.5; }

/* ── VIDEO MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.8);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 860px;
  overflow: hidden;
}
.modal-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  transition: color .2s;
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 1.5rem; }
.video-wrapper { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 10px; }
.video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }

/* ── DASHBOARD ── */
.dash-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 68px);
}
.sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: .9rem;
  transition: all .2s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(108,99,255,.15);
  color: var(--primary);
}
.dash-content { padding: 2.5rem; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th {
  background: var(--bg-card2);
  padding: 1rem;
  text-align: left;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(108,99,255,.05); }

/* ── BADGE ── */
.badge {
  display: inline-block;
  padding: .25rem .75rem;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-success { background: rgba(16,185,129,.15); color: var(--success); }
.badge-danger { background: rgba(239,68,68,.15); color: var(--danger); }
.badge-primary { background: rgba(108,99,255,.15); color: var(--primary); }

/* ── TOGGLE ── */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px; height: 24px;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 50px;
  cursor: pointer;
  transition: .3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px; left: 3px;
  transition: .3s;
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── AUTH PAGE ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg-dark);
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108,99,255,.2), transparent 70%);
  top: -100px; right: -100px;
}
.auth-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245,158,11,.15), transparent 70%);
  bottom: -100px; left: -100px;
}
.auth-box {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}
.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-logo h2 {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-logo p { color: var(--text-muted); font-size: .9rem; margin-top: .3rem; }
.divider {
  text-align: center;
  color: var(--text-muted);
  font-size: .8rem;
  margin: 1.2rem 0;
  position: relative;
}
.divider::before, .divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--border);
}
.divider::before { left: 0; }
.divider::after { right: 0; }
.social-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: .75rem;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: all .25s;
  margin-bottom: .75rem;
}
.social-btn:hover { border-color: var(--primary); background: rgba(108,99,255,.08); }

/* ── STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(108,99,255,.1);
}
.stat-card .stat-num { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }

/* ── ALERT ── */
.alert {
  padding: .85rem 1.2rem;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 500;
  margin-bottom: 1rem;
  display: none;
}
.alert.show { display: block; }
.alert-error { background: rgba(239,68,68,.15); color: #f87171; border: 1px solid rgba(239,68,68,.3); }
.alert-success { background: rgba(16,185,129,.15); color: #34d399; border: 1px solid rgba(16,185,129,.3); }

/* ── LOCKED BANNER ── */
.locked-banner {
  background: linear-gradient(135deg, rgba(239,68,68,.15), rgba(245,158,11,.1));
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
}
.locked-banner .lock-icon { font-size: 3rem; margin-bottom: 1rem; }
.locked-banner h3 { font-size: 1.4rem; font-weight: 700; margin-bottom: .5rem; }
.locked-banner p { color: var(--text-muted); }

/* ── FOOTER ── */
footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .dash-layout { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; padding: 1rem; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar-link { width: auto; }
  .grades-grid { grid-template-columns: repeat(3, 1fr); }
  .nav-links .hide-mobile { display: none; }
}
@media (max-width: 480px) {
  .grades-grid { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 1.8rem; }
}

/* ── ANIMATIONS ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate { animation: fadeInUp .5s ease forwards; }
.delay-1 { animation-delay: .1s; opacity: 0; }
.delay-2 { animation-delay: .2s; opacity: 0; }
.delay-3 { animation-delay: .3s; opacity: 0; }

/* ── LOADING ── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 4rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
}

/* ── GRADES DROPDOWN NAV ─────────────────────────────────── */
.nav-dropdown { position: relative; }
.nav-dropdown-trigger {
  display: flex; align-items: center; gap: .3rem;
  color: var(--text-muted); font-size: .9rem; font-weight: 500;
  cursor: pointer; background: none; border: none;
  font-family: 'Inter', sans-serif; padding: 0; transition: color .2s;
}
.nav-dropdown-trigger:hover { color: var(--text); }
.nav-dropdown-trigger .chevron { font-size: .6rem; transition: transform .2s; }
.nav-dropdown.open .chevron { transform: rotate(180deg); }
.nav-dropdown-menu {
  display: none; position: absolute;
  top: calc(100% + .75rem); left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .5rem; min-width: 170px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4); z-index: 1000;
}
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .9rem; border-radius: 8px;
  color: var(--text-muted); font-size: .88rem; font-weight: 500; transition: all .15s;
}
.nav-dropdown-menu a:hover { background: rgba(108,99,255,.12); color: var(--primary); }
.nav-dropdown-menu a.current-grade { background: rgba(108,99,255,.18); color: var(--primary); font-weight: 700; }

/* ── BREADCRUMB ──────────────────────────────────────────── */
.grade-breadcrumb {
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  padding: .75rem 2rem; display: flex; align-items: center;
  gap: .5rem; font-size: .82rem; color: var(--text-muted);
  overflow-x: auto; white-space: nowrap;
}
.grade-breadcrumb a { color: var(--text-muted); transition: color .15s; }
.grade-breadcrumb a:hover { color: var(--primary); }
.grade-breadcrumb .sep { opacity: .4; }
.grade-breadcrumb .current { color: var(--text); font-weight: 600; }

/* ── GRADE TWO-COLUMN LAYOUT ─────────────────────────────── */
.grade-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}
.grade-sidebar { position: sticky; top: 90px; height: fit-content; }
.grade-sidebar-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.grade-sidebar-card .sidebar-heading {
  background: linear-gradient(135deg, var(--primary-dark), #8b5cf6);
  padding: .85rem 1.1rem; font-size: .78rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
}
.grade-nav-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .75rem 1.1rem; font-size: .88rem; font-weight: 500;
  color: var(--text-muted); border-bottom: 1px solid var(--border); transition: all .15s;
}
.grade-nav-link:last-child { border-bottom: none; }
.grade-nav-link:hover { background: rgba(108,99,255,.08); color: var(--primary); }
.grade-nav-link.active { background: rgba(108,99,255,.15); color: var(--primary); font-weight: 700; }

/* ── VIEW TOGGLE ─────────────────────────────────────────── */
.view-toggle { display: flex; gap: .4rem; }
.view-toggle button {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-muted); padding: .4rem .65rem;
  cursor: pointer; font-size: .9rem; transition: all .15s;
}
.view-toggle button.active { background: rgba(108,99,255,.15); border-color: var(--primary); color: var(--primary); }

/* ── LESSON LIST ITEM ────────────────────────────────────── */
.lesson-list { display: flex; flex-direction: column; gap: 1rem; }
.lesson-list-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); display: flex; align-items: stretch;
  overflow: hidden; transition: all .25s; cursor: pointer;
}
.lesson-list-item:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateX(4px); }
.lesson-list-icon {
  background: linear-gradient(135deg, var(--primary-dark), #8b5cf6);
  width: 72px; min-width: 72px; display: flex;
  align-items: center; justify-content: center; font-size: 1.8rem; flex-shrink: 0;
}
.lesson-list-body {
  padding: 1rem 1.25rem; flex: 1; display: flex;
  align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.lesson-list-info h3 { font-size: .98rem; font-weight: 700; margin-bottom: .25rem; }
.lesson-list-info p  { font-size: .82rem; color: var(--text-muted); line-height: 1.5; }
.lesson-list-meta { display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; flex-shrink: 0; }

/* ── TOPIC TAG ───────────────────────────────────────────── */
.topic-tag {
  display: inline-block; background: rgba(245,158,11,.12); color: var(--secondary);
  border: 1px solid rgba(245,158,11,.25); border-radius: 50px;
  padding: .2rem .65rem; font-size: .72rem; font-weight: 600;
}

@media (max-width: 768px) {
  .grade-layout { grid-template-columns: 1fr; padding: 1rem; }
  .grade-sidebar { position: static; }
  .grade-breadcrumb { padding: .6rem 1rem; }
}
