/* ===== CyberHeroesHQ — Teacher Dashboard CSS ===== */
/* Design: Clean, professional, ISTE-friendly. Google Classroom polish.
   Deliberately different from the dark anime kid UI. */

/* ── Reset / base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-50:  #eff6ff;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50:  #f8fafc;
  --white:     #ffffff;
  --green-500: #22c55e;
  --green-100: #dcfce7;
  --amber-500: #f59e0b;
  --amber-100: #fef3c7;
  --red-500:   #ef4444;
  --red-100:   #fee2e2;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--slate-900);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Auth pages ──────────────────────────────────────────────────────────── */
.teacher-auth-page {
  background: var(--slate-50);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.t-auth-wrap {
  width: 100%;
  max-width: 440px;
}

.t-auth-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-md);
}

.t-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.t-brand-icon { font-size: 1.4rem; }

.t-brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--slate-900);
}

.t-brand-sub {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--slate-400);
  background: var(--slate-100);
  padding: 2px 8px;
  border-radius: 20px;
}

.t-auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 6px;
}

.t-auth-sub {
  color: var(--slate-600);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.t-auth-footer {
  font-size: 0.85rem;
  color: var(--slate-600);
  margin-top: 16px;
  text-align: center;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.t-form { display: flex; flex-direction: column; gap: 16px; }

.t-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.t-field label {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--slate-700);
}

.t-optional {
  font-weight: 400;
  color: var(--slate-400);
}

.t-field input,
.t-field select {
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 10px 14px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
  color: var(--slate-900);
  background: var(--white);
}

.t-field input:focus,
.t-field select:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.t-btn-primary {
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--white);
  background: var(--blue-600);
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, box-shadow 0.15s;
}
.t-btn-primary:hover { background: var(--blue-500); text-decoration: none; color: #fff; }

.t-btn-secondary {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue-600);
  background: var(--blue-50);
  border: 1.5px solid rgba(37,99,235,0.2);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.t-btn-secondary:hover { background: #dbeafe; text-decoration: none; color: var(--blue-600); }

.t-btn-ghost {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--slate-600);
  background: none;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.t-btn-ghost:hover { background: var(--slate-100); text-decoration: none; color: var(--slate-800); }

.t-btn-logout {
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--slate-600);
  background: none;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.t-btn-logout:hover { background: var(--slate-100); }

.t-btn-xs { padding: 4px 10px; font-size: 0.78rem; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.t-alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 20px;
}
.t-alert-error { background: var(--red-100); color: #b91c1c; border: 1px solid #fca5a5; }
.t-alert-info  { background: var(--blue-50); color: #1d4ed8; border: 1px solid #93c5fd; }

/* ── App shell (dashboard pages) ────────────────────────────────────────── */
.teacher-app-page {
  background: var(--slate-50);
  min-height: 100vh;
}

/* Top nav */
.t-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  height: 58px;
}

.t-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.t-nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--slate-900);
  text-decoration: none;
}
.t-nav-brand:hover { text-decoration: none; color: var(--slate-900); }

.t-brand-icon { font-size: 1.1rem; }

.t-nav-sub {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--slate-400);
  background: var(--slate-100);
  padding: 2px 8px;
  border-radius: 20px;
}

.t-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.t-nav-user {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--slate-700);
}

.t-nav-school {
  font-size: 0.82rem;
  color: var(--slate-400);
}

/* Main content area */
.t-main {
  padding: 32px 0 64px;
}

.t-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Page header */
.t-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.t-page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 4px;
}

.t-page-sub {
  font-size: 0.9rem;
  color: var(--slate-500);
}

.t-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Breadcrumb */
.t-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--slate-500);
  margin-bottom: 20px;
}
.t-breadcrumb a { color: var(--blue-600); }
.t-breadcrumb a:hover { text-decoration: underline; }

/* ── Classroom grid ──────────────────────────────────────────────────────── */
.t-classroom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.t-classroom-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}
.t-classroom-card:hover { box-shadow: var(--shadow-md); }

.t-classroom-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.t-classroom-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1.3;
}

.t-join-code {
  font-size: 0.78rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--blue-600);
  background: var(--blue-50);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: 6px;
  padding: 4px 10px;
  white-space: nowrap;
  letter-spacing: 0.05em;
}

.t-classroom-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.t-classroom-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.t-stat-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1;
}

.t-stat-lbl {
  font-size: 0.78rem;
  color: var(--slate-500);
  margin-top: 2px;
}

.t-classroom-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.t-empty-state {
  text-align: center;
  padding: 60px 24px;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
}

.t-empty-icon { font-size: 3rem; margin-bottom: 16px; }

.t-empty-state h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 8px;
}

.t-empty-state p {
  color: var(--slate-500);
  font-size: 0.92rem;
  margin-bottom: 24px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Classroom detail ────────────────────────────────────────────────────── */
.t-code-display {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--slate-600);
  margin-top: 6px;
  flex-wrap: wrap;
}

.t-code-value {
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  color: var(--blue-600);
  background: var(--blue-50);
  border: 1px solid rgba(37,99,235,0.2);
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

/* ── Table ───────────────────────────────────────────────────────────────── */
.t-roster-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.t-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--slate-900);
}

.t-section-sub {
  font-size: 0.88rem;
  color: var(--slate-500);
  margin-top: 4px;
  margin-bottom: 18px;
}

.t-table-wrap {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.t-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.t-table thead tr {
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
}

.t-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-500);
}

.t-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}

.t-table tbody tr:last-child td { border-bottom: none; }
.t-table tbody tr:hover td { background: var(--slate-50); }

.t-num-col { text-align: center; }

.t-student-name {
  font-weight: 600;
  color: var(--slate-900);
  line-height: 1.3;
}

.t-student-username {
  font-size: 0.8rem;
  color: var(--slate-400);
  margin-top: 2px;
}

.t-level-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--slate-700);
  background: var(--slate-100);
  padding: 3px 8px;
  border-radius: 20px;
}

.t-xp-val {
  font-weight: 600;
  color: var(--blue-600);
}

.t-missions-badge {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate-600);
  background: var(--slate-100);
  padding: 3px 10px;
  border-radius: 20px;
}

.t-missions-badge.all-done {
  color: #15803d;
  background: var(--green-100);
}

.t-date { color: var(--slate-500); font-size: 0.85rem; }
.t-muted { color: var(--slate-300); }

/* ── Report page ─────────────────────────────────────────────────────────── */
.t-report-section {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.t-mission-stats { display: flex; flex-direction: column; gap: 16px; }

.t-mission-stat-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.t-mission-stat-info { flex: 1; min-width: 0; }

.t-mission-stat-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--slate-900);
  margin-bottom: 2px;
}

.t-mission-stat-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--slate-500);
  flex-wrap: wrap;
}

.t-dot { color: var(--slate-300); }

.t-progress-col {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 200px;
  flex-shrink: 0;
}

.t-progress-bar-wrap {
  flex: 1;
  height: 10px;
  background: var(--slate-100);
  border-radius: 5px;
  overflow: hidden;
}

.t-progress-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
}

.t-progress-pct {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate-700);
  width: 36px;
  text-align: right;
}

/* Most missed questions */
.t-missed-list { display: flex; flex-direction: column; gap: 12px; }

.t-missed-item {
  padding: 16px 20px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
}

.t-missed-mission {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #92400e;
  margin-bottom: 4px;
}

.t-missed-question {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--slate-900);
  margin-bottom: 6px;
}

.t-missed-answer {
  font-size: 0.82rem;
  color: var(--slate-600);
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.t-modal {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 460px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.t-modal::backdrop {
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
}

.t-modal-inner {
  padding: 32px;
}

.t-modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 6px;
}

.t-modal-sub {
  font-size: 0.88rem;
  color: var(--slate-500);
  margin-bottom: 24px;
}

.t-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* ── Dashboard two-column layout ─────────────────────────────────────────── */
.t-dash-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  align-items: start;
}

.t-dash-main {}
.t-dash-sidebar {}

/* ── Activity feed ───────────────────────────────────────────────────────── */
.t-activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--white);
}

.t-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--slate-100);
}

.t-activity-item:last-child {
  border-bottom: none;
}

.t-activity-avatar {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.t-activity-body {
  flex: 1;
  font-size: 0.84rem;
  color: var(--slate-700);
  line-height: 1.4;
}

.t-activity-name {
  font-weight: 600;
  color: var(--slate-900);
}

.t-activity-mission {
  font-weight: 500;
  color: var(--blue-600);
}

.t-activity-class {
  color: var(--slate-500);
  font-size: 0.8rem;
}

.t-activity-score {
  font-size: 0.8rem;
  color: var(--green-500);
  margin-top: 2px;
}

.t-activity-time {
  font-size: 0.75rem;
  color: var(--slate-400);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Progress matrix ─────────────────────────────────────────────────────── */
.t-matrix-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
}

.t-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  min-width: 480px;
}

.t-matrix-table thead th {
  background: var(--slate-50);
  border-bottom: 2px solid var(--slate-200);
  padding: 10px 8px;
  font-weight: 600;
  color: var(--slate-700);
  text-align: center;
}

.t-matrix-student-col {
  text-align: left !important;
  min-width: 130px;
  padding-left: 14px !important;
}

.t-matrix-mission-col {
  min-width: 90px;
}

.t-matrix-mission-label {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.t-matrix-table tbody tr {
  border-bottom: 1px solid var(--slate-100);
}

.t-matrix-table tbody tr:hover {
  background: var(--slate-50);
}

.t-matrix-cell {
  text-align: center;
  padding: 8px 6px;
  vertical-align: middle;
  font-size: 0.82rem;
}

.t-matrix-done {
  background: #f0fdf4;
  color: #16a34a;
  font-weight: 700;
}

.t-matrix-inprog {
  background: #fef3c7;
  color: #d97706;
}

.t-matrix-empty {
  color: var(--slate-300);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .t-dash-layout { grid-template-columns: 1fr; }
  .t-dash-sidebar { order: -1; }
}

@media (max-width: 640px) {
  .t-auth-card { padding: 28px 20px; }
  .t-page-header { flex-direction: column; }
  .t-mission-stat-row { flex-direction: column; align-items: flex-start; }
  .t-progress-col { width: 100%; }
  .t-classroom-grid { grid-template-columns: 1fr; }
  .t-table { font-size: 0.82rem; }
  .t-table th, .t-table td { padding: 10px 12px; }
}

@media print {
  .t-nav, .t-header-actions, .t-btn-ghost, .t-btn-secondary { display: none !important; }
  .t-main { padding: 0; }
  .t-report-section { box-shadow: none; border: 1px solid #ddd; }
}
