@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary:       #0ea5e9;
  --primary-dark:  #0284c7;
  --primary-light: #e0f2fe;
  --success:       #10b981;
  --danger:        #ef4444;
  --warning:       #f59e0b;
  --bg:            #f0f9ff;
  --sidebar-bg:    #082f49;
  --sidebar-text:  #7dd3fc;
  --card:          #ffffff;
  --border:        #bae6fd;
  --text:          #0c4a6e;
  --text-muted:    #64748b;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Login page ─────────────────────────────────────────── */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #082f49 0%, #0369a1 50%, #38bdf8 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  top: -150px; left: -150px;
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  bottom: -100px; right: -100px;
  pointer-events: none;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 44px 40px;
  width: 380px;
  box-shadow: 0 32px 80px rgba(8,47,73,0.4);
  position: relative;
  z-index: 1;
}

.login-logo {
  font-size: 48px;
  margin-bottom: 14px;
  display: block;
  text-align: center;
  color: var(--primary);
}
.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
  text-align: center;
}
.login-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 13px;
  text-align: center;
}
.btn-block { width: 100%; justify-content: center; margin-top: 6px; }

/* ── App layout ─────────────────────────────────────────── */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: linear-gradient(180deg, #082f49 0%, #0c4a6e 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(8,47,73,0.3);
}

.sidebar-brand {
  padding: 28px 22px 22px;
  border-bottom: 1px solid rgba(125,211,252,0.12);
  background: rgba(0,0,0,0.15);
}
.sidebar-brand .app-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 9px;
  letter-spacing: 0.01em;
}
.sidebar-brand .user-info {
  margin-top: 12px;
  font-size: 12px;
  color: #7dd3fc;
}
.sidebar-brand .user-info strong { color: #e0f2fe; font-weight: 600; }

.nav-section {
  padding: 20px 22px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #38bdf8;
  opacity: 0.6;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  color: #7dd3fc;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  border-radius: 0 6px 6px 0;
  margin: 1px 8px 1px 0;
}

.nav-item a:hover {
  background: rgba(125,211,252,0.1);
  color: #e0f2fe;
}

.nav-item a.active {
  background: linear-gradient(90deg, rgba(14,165,233,0.3) 0%, rgba(14,165,233,0.1) 100%);
  color: #ffffff;
  border-left-color: #38bdf8;
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px 22px;
  border-top: 1px solid rgba(125,211,252,0.12);
}

.sidebar-footer a {
  color: #7dd3fc;
  text-decoration: none;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.sidebar-footer a:hover { opacity: 1; color: #e0f2fe; }

.content {
  margin-left: 250px;
  flex: 1;
  padding: 36px;
}

/* ── Page header ────────────────────────────────────────── */

.page-header {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-text h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.page-header-text p { color: var(--text-muted); margin-top: 3px; font-size: 13px; }

/* ── Cards ──────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(14,165,233,0.07);
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(90deg, #f0f9ff 0%, #fff 100%);
}
.card-header h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.card-body { padding: 22px; }

/* ── Alerts ─────────────────────────────────────────────── */

.alert {
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-error   { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
.alert-success { background: #f0fdf4; color: #15803d; border-color: #86efac; }
.alert-info    { background: #e0f2fe; color: #0369a1; border-color: #7dd3fc; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fcd34d; }

/* ── Buttons ────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.btn:hover { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(14,165,233,0.2); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
  box-shadow: 0 2px 8px rgba(14,165,233,0.35);
}
.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}
.btn-danger  {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239,68,68,0.3);
}
.btn-ghost   { background: #fff; color: var(--text); border-color: var(--border); box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.btn-sm      { padding: 5px 12px; font-size: 12px; }

/* ── Forms ──────────────────────────────────────────────── */

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-group .form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid #bae6fd;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}

textarea.form-control {
  resize: vertical;
  font-family: 'Consolas', 'Fira Code', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
}

/* ── Tables ─────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; border-radius: 8px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #0369a1;
  border-bottom: 2px solid #bae6fd;
  background: #f0f9ff;
  white-space: nowrap;
}

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid #e0f2fe;
  vertical-align: middle;
  color: var(--text);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f0f9ff; transition: background 0.12s; }

/* ── Edge vector badges ─────────────────────────────────── */

.edge-vector { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; }

.edge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: default;
  user-select: none;
  flex-shrink: 0;
}
.edge-pass { background: #dcfce7; color: #15803d; }
.edge-fail { background: #fee2e2; color: #b91c1c; }

/* ── Score ──────────────────────────────────────────────── */

.score { font-weight: 700; font-size: 14px; }
.score-good { color: var(--success); }
.score-mid  { color: var(--warning); }
.score-bad  { color: var(--danger);  }
.text-muted { color: var(--text-muted); }

/* ── Badges ─────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.badge-student { background: #e0f2fe; color: #0369a1; }
.badge-teacher { background: #dcfce7; color: #15803d; }
.badge-visible { background: #dcfce7; color: #15803d; }
.badge-hidden  { background: #fee2e2; color: #b91c1c; }

/* ── Criteria detail table ──────────────────────────────── */

.criteria-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 4px;
}
.criteria-table tr { border-bottom: 1px solid #f1f5f9; }
.criteria-table tr:last-child { border-bottom: none; }
.crit-icon {
  width: 22px;
  font-weight: 700;
  font-size: 13px;
  padding: 3px 4px;
  text-align: center;
}
.crit-id {
  width: 28px;
  color: var(--text-muted);
  padding: 3px 4px;
  font-family: monospace;
}
.crit-desc { padding: 3px 4px; color: var(--text); }
.crit-pass .crit-icon { color: #15803d; }
.crit-fail .crit-icon { color: #b91c1c; }
.crit-pass { background: #f0fdf4; }
.crit-fail { background: #fff1f2; }

/* ── Toggle switch ──────────────────────────────────────── */

.toggle-wrap { display: flex; align-items: center; gap: 10px; }

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 24px;
  transition: background 0.22s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.22s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Stat boxes ─────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 22px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(14,165,233,0.08);
  transition: transform 0.18s, box-shadow 0.18s;
}
.stat-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(14,165,233,0.16);
}
.stat-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
  border-radius: 12px 12px 0 0;
}
.stat-box .stat-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
  color: var(--text);
}
.stat-box .stat-label { color: var(--text-muted); font-size: 12px; font-weight: 500; }

/* ── Code block ─────────────────────────────────────────── */

.code-block {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 16px;
  font-family: 'Consolas', 'Fira Code', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
  max-height: 320px;
  overflow-y: auto;
}

/* ── Misc ───────────────────────────────────────────────── */

.mt-1 { margin-top: 4px;  }
.mt-2 { margin-top: 8px;  }
.mt-3 { margin-top: 16px; }
.mb-3 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }

/* ── Font Awesome icon alignment ────────────────────────── */
.nav-item a i,
.sidebar-brand .app-name i,
.sidebar-footer a i,
.btn i {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}
.badge i { width: auto; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.syntax-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 10px 14px;
  font-family: monospace;
  font-size: 12px;
  color: #b91c1c;
}
