/* ===== Batari School — Design System ===== */
:root {
  --bg-1: #0f2027;
  --bg-2: #203a43;
  --bg-3: #2c5364;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-strong: rgba(255, 255, 255, 0.1);
  --text: #eef4f6;
  --text-dim: #a9bbc2;
  --text-faint: #7c8f97;
  --accent-a: #7c3aed;
  --accent-b: #3b82f6;
  --accent-grad: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body {
  font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 15% 10%, #234956 0%, transparent 45%),
              radial-gradient(circle at 90% 80%, #2d1b4e 0%, transparent 40%),
              linear-gradient(160deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 6px; font-weight: 600; }
p { margin: 0 0 8px; color: var(--text-dim); }

.gradient-text {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  border: none;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.35);
}
.btn-primary:hover { box-shadow: 0 8px 24px rgba(124, 58, 237, 0.5); }
.btn-ghost {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--glass-strong); }
.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.28); }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ===== Auth / Login ===== */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 44px 38px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-logo { font-size: 44px; margin-bottom: 6px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-dim); font-size: 14px; margin-bottom: 28px; }
.field { text-align: left; margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent-b); }
.field-hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; }
.field textarea { resize: vertical; min-height: 90px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 180px; }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 18px;
  text-align: left;
}
.alert-error { background: rgba(239, 68, 68, 0.14); border: 1px solid rgba(239, 68, 68, 0.35); color: #fca5a5; }
.alert-success { background: rgba(34, 197, 94, 0.14); border: 1px solid rgba(34, 197, 94, 0.35); color: #86efac; }
.alert-info { background: rgba(56, 189, 248, 0.12); border: 1px solid rgba(56, 189, 248, 0.3); color: #7dd3fc; }

.footer-note { margin-top: 28px; font-size: 12px; color: var(--text-faint); }

/* ===== App Shell ===== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: rgba(8, 18, 24, 0.55);
  border-right: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  padding: 26px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 20;
  transition: transform 0.2s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px; }
.sidebar-brand .logo { font-size: 26px; }
.sidebar-brand .name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar-brand .name span { display: block; font-size: 11px; font-weight: 400; color: var(--text-faint); }

.nav-section { margin-bottom: 18px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); padding: 0 12px; margin-bottom: 8px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 3px;
}
.nav-link:hover { background: var(--glass); color: var(--text); }
.nav-link.active { background: var(--accent-grad); color: #fff; font-weight: 600; }
.nav-link .ic { width: 18px; text-align: center; }

.sidebar-user {
  margin-top: auto;
  border-top: 1px solid var(--glass-border);
  padding-top: 16px;
  font-size: 12.5px;
}
.sidebar-user .u-name { font-weight: 600; font-size: 13.5px; }
.sidebar-user .u-role { color: var(--text-faint); margin-bottom: 10px; }

.main {
  flex: 1;
  min-width: 0;
  padding: 28px 34px 60px;
}
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 12px; }
.topbar h1 { font-size: 22px; }
.topbar .desc { font-size: 13.5px; color: var(--text-dim); }
.menu-toggle { display: none; }

/* ===== Cards / Grid ===== */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.card-head h2 { font-size: 16px; }
.card-head h3 { font-size: 15px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.stat-card { padding: 20px; }
.stat-card .stat-icon { font-size: 22px; margin-bottom: 10px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card .stat-label { font-size: 12.5px; color: var(--text-faint); }

/* ===== Table ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--glass-border); white-space: nowrap; }
th { color: var(--text-faint); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
td.wrap, th.wrap { white-space: normal; }
.table-empty { padding: 40px 20px; text-align: center; color: var(--text-faint); }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-green { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.badge-blue { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; }
.badge-purple { background: rgba(167, 139, 250, 0.18); color: #c4b5fd; }
.badge-gray { background: rgba(255, 255, 255, 0.1); color: var(--text-dim); }
.badge-orange { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.badge-red { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

/* ===== Assignment / question list items ===== */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.list-item:hover { background: rgba(255, 255, 255, 0.05); }
.list-item .li-main { min-width: 220px; flex: 1; }
.list-item .li-title { font-weight: 600; font-size: 14.5px; margin-bottom: 4px; }
.list-item .li-meta { font-size: 12px; color: var(--text-faint); display: flex; gap: 12px; flex-wrap: wrap; }
.list-item .li-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ===== Quiz taking ===== */
.quiz-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10, 22, 28, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--glass-border);
  padding: 16px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 18px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
}
.timer.low { color: #fca5a5; border-color: rgba(239, 68, 68, 0.5); animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.quiz-body { max-width: 780px; margin: 0 auto; padding: 30px 20px 90px; }
.question-card { margin-bottom: 18px; }
.question-num { font-size: 12px; color: var(--text-faint); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.question-text { font-size: 16px; margin-bottom: 18px; line-height: 1.55; }
.option-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  margin-bottom: 9px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.option-row:hover { border-color: rgba(255, 255, 255, 0.25); }
.option-row.checked { border-color: var(--accent-b); background: rgba(59, 130, 246, 0.12); }
.option-row input { accent-color: var(--accent-b); width: 17px; height: 17px; }

.quiz-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(10, 22, 28, 0.9);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--glass-border);
  padding: 14px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.autosave-hint { font-size: 12px; color: var(--text-faint); }

.q-progress { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.q-progress a {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  font-size: 12px;
  color: var(--text-dim);
}
.q-progress a.answered { background: rgba(34, 197, 94, 0.18); border-color: rgba(34, 197, 94, 0.4); color: #86efac; }

/* ===== Misc ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-faint); }
.empty-state .icon { font-size: 40px; margin-bottom: 10px; }
.divider { height: 1px; background: var(--glass-border); margin: 20px 0; border: none; }
.text-dim { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }
.flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.pill-group { display: flex; gap: 8px; flex-wrap: wrap; }
.small { font-size: 12.5px; }
.link-accent { color: #7dd3fc; }
.link-accent:hover { text-decoration: underline; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 20px 16px 60px; }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
  }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 15; }
  .sidebar-overlay.show { display: block; }
}
