/* ============================================================
   NŪR · nurteach.com · Global Stylesheet
   ============================================================ */

:root {
  --purple-900: #1A1545;
  --purple-700: #3C3489;
  --purple-500: #534AB7;
  --purple-300: #7F77DD;
  --purple-100: #CECBF6;
  --purple-50:  #EEEDFE;
  --teal-600:   #0F6E56;
  --teal-400:   #1D9E75;
  --teal-100:   #9FE1CB;
  --teal-50:    #E1F5EE;
  --warm-white: #F7F5EF;
  --warm-100:   #EDE9DF;
  --ink:        #1A1A18;
  --ink-60:     #5A5A56;
  --ink-30:     #A8A8A4;
  --red:        #DC2626;
  --red-50:     #FEF2F2;
  --radius:     12px;
  --radius-lg:  16px;
  --shadow:     0 2px 20px rgba(83,74,183,0.08);
  --shadow-lg:  0 4px 40px rgba(83,74,183,0.14);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--warm-white);
  color: var(--ink);
  min-height: 100vh;
}
a { color: var(--purple-500); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── LAYOUT ── */
.layout  { display: flex; min-height: calc(100vh - 58px); }
.main    { flex: 1; padding: 32px; overflow-x: hidden; }

/* ── TYPOGRAPHY ── */
.page-title { font-size: 22px; font-weight: 500; color: var(--ink); margin-bottom: 4px; }
.page-sub   { font-size: 13px; color: var(--ink-60); margin-bottom: 24px; }
h2.section  { font-size: 15px; font-weight: 500; margin-bottom: 14px; }

/* ── CARDS ── */
.card {
  background: #fff;
  border: 1px solid var(--warm-100);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 16px; }
.card-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.card-sub   { font-size: 12px; color: var(--ink-60); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 20px; border-radius: 10px; font-size: 13px;
  font-weight: 500; cursor: pointer; border: none;
  font-family: 'DM Sans', sans-serif;
  transition: opacity 0.15s, transform 0.15s;
  text-decoration: none;
}
.btn:hover { opacity: 0.88; transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--purple-500); color: #fff; }
.btn-teal    { background: var(--teal-400);   color: #fff; }
.btn-danger  { background: var(--red);        color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--purple-300);
  color: var(--purple-500);
}
.btn-ghost {
  background: var(--warm-white);
  border: 1px solid var(--warm-100);
  color: var(--ink-60);
}
.btn-ghost:hover { border-color: var(--purple-300); color: var(--purple-500); }
.btn-sm  { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.btn-lg  { padding: 13px 28px; font-size: 15px; border-radius: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ── FORMS ── */
.form-group  { margin-bottom: 18px; }
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-label  { display: block; font-size: 12px; font-weight: 500; color: var(--ink-60); margin-bottom: 6px; }
.form-input  {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--warm-100); font-size: 14px;
  font-family: 'DM Sans', sans-serif; background: #fff;
  color: var(--ink); transition: border-color 0.15s;
  outline: none;
}
.form-input:focus { border-color: var(--purple-300); box-shadow: 0 0 0 3px var(--purple-50); }
.form-input.error { border-color: var(--red); }
textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input   { cursor: pointer; }
.form-hint  { font-size: 11px; color: var(--ink-30); margin-top: 4px; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 500;
}
.badge-purple { background: var(--purple-50); color: var(--purple-700); }
.badge-teal   { background: var(--teal-50);   color: var(--teal-600); }
.badge-warm   { background: var(--warm-100);  color: var(--ink-60); }
.badge-red    { background: var(--red-50);    color: var(--red); }

/* ── ALERTS ── */
.alert {
  padding: 12px 16px; border-radius: 10px;
  font-size: 13px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.alert-error   { background: var(--red-50);  border: 1px solid #fecaca; color: #991b1b; }
.alert-success { background: var(--teal-50); border: 1px solid var(--teal-100); color: var(--teal-600); }
.alert-info    { background: var(--purple-50); border: 1px solid var(--purple-100); color: var(--purple-700); }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--warm-100); }
table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
thead th {
  text-align: left; padding: 11px 16px;
  font-size: 10px; font-weight: 500; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--ink-30);
  background: var(--warm-white); border-bottom: 1px solid var(--warm-100);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--warm-100); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--purple-50); }
tbody td { padding: 11px 16px; color: var(--ink-60); vertical-align: middle; }
tbody td:first-child { color: var(--ink); font-weight: 500; }

/* ── CODE BLOCKS ── */
.code-block {
  background: var(--ink); color: #e2e8f0;
  border-radius: 10px; padding: 16px; font-family: monospace;
  font-size: 13px; line-height: 1.6; overflow-x: auto;
}

/* ── JOIN CODE ── */
.join-code {
  font-family: monospace; font-size: 13px; font-weight: 600;
  background: var(--purple-50); color: var(--purple-500);
  padding: 4px 10px; border-radius: 6px; letter-spacing: 2px;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 60px 32px;
  background: #fff; border-radius: var(--radius-lg);
  border: 1px solid var(--warm-100);
}
.empty-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--purple-50);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.empty-title { font-size: 16px; font-weight: 500; margin-bottom: 8px; }
.empty-sub   { font-size: 13px; color: var(--ink-60); margin-bottom: 20px; }

/* ── DIVIDER ── */
.divider { height: 1px; background: var(--warm-100); margin: 24px 0; }

/* ── GRADE CELLS ── */
.grade-cell {
  width: 100%; border: none; border-radius: 6px; padding: 5px;
  text-align: center; font-size: 13px; font-weight: 500;
  background: var(--warm-white); color: var(--ink);
  cursor: pointer; outline: none; transition: background 0.15s;
}
.grade-cell:focus { background: var(--purple-50); border: 1px solid var(--purple-300); }
.grade-cell.filled { background: var(--teal-50); color: var(--teal-600); }
.grade-cell.at-risk { background: var(--red-50); color: var(--red); }

/* ── PROGRESS BAR ── */
.progress-bar { height: 6px; border-radius: 999px; background: var(--warm-100); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--purple-500); transition: width 0.5s ease; }
.progress-fill.teal { background: var(--teal-400); }
.progress-fill.red  { background: var(--red); }

/* ── MODAL ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 300;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 20px; padding: 36px;
  width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.modal-title { font-size: 18px; font-weight: 500; }
.modal-close {
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--ink-30); line-height: 1;
}
.modal-close:hover { color: var(--ink); }

/* ── QUIZ QUESTION CARD ── */
.question-card {
  background: #fff; border: 1px solid var(--warm-100);
  border-radius: var(--radius); padding: 20px; margin-bottom: 14px;
  position: relative;
}
.question-card:hover { border-color: var(--purple-300); }
.question-num {
  position: absolute; top: -10px; left: 16px;
  background: var(--purple-500); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 10px; border-radius: 999px;
}

/* ── LIVE SESSION ── */
.room-code-display {
  font-family: monospace; font-size: 48px; font-weight: 700;
  letter-spacing: 12px; color: var(--purple-500);
  text-align: center; padding: 20px;
  background: var(--purple-50); border-radius: var(--radius-lg);
}
.activity-popup {
  background: var(--purple-900); color: #fff;
  border-radius: var(--radius-lg); padding: 28px;
  text-align: center; animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { opacity:0; transform: translateY(20px); }
  to   { opacity:1; transform: translateY(0); }
}

/* ── SIDEBAR ACTIVE STATE ── */
.sidebar-link.active {
  background: var(--purple-50) !important;
  color: var(--purple-500) !important;
  border-right: 2px solid var(--purple-500);
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .main { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
}