/* ═══════════════════════════════════════════════
   ExamZEN — Design System v2
   Minimal · Flat · Content-First
═══════════════════════════════════════════════ */

/* ── TOKENS ─────────────────────────────────── */
:root {
  --bg:        #0a0a0a;
  --surface:   #111111;
  --surface-2: #161616;
  --hover:     #1c1c1c;

  --border:    #1f1f1f;
  --border-2:  #2a2a2a;

  --text:      #ededed;
  --text-sub:  #a1a1aa;
  --text-dim:  #52525b;

  --accent:        #6366f1;
  --accent-dim:    rgba(99, 102, 241, 0.12);
  --accent-border: rgba(99, 102, 241, 0.25);

  --green:         #22c55e;
  --green-dim:     rgba(34, 197, 94, 0.10);
  --green-border:  rgba(34, 197, 94, 0.25);
  --red:           #ef4444;
  --red-dim:       rgba(239, 68, 68, 0.10);
  --red-border:    rgba(239, 68, 68, 0.25);
  --yellow:        #eab308;
  --yellow-dim:    rgba(234, 179, 8, 0.10);
  --yellow-border: rgba(234, 179, 8, 0.25);

  --sidebar-w: 220px;

  --r-sm: 4px;
  --r:    7px;
  --r-lg: 11px;

  --t: 140ms ease;

  --font:      'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

[data-theme="light"] {
  --bg:        #fafafa;
  --surface:   #ffffff;
  --surface-2: #f4f4f5;
  --hover:     #eeeeef;
  --border:    #e4e4e7;
  --border-2:  #d4d4d8;
  --text:      #09090b;
  --text-sub:  #52525b;
  --text-dim:  #a1a1aa;
}

/* ── RESET ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t), color var(--t);
}

a { text-decoration: none; color: inherit; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ══════════════════════════════════════════════
   SIDEBAR — Fixed position, always on the left
══════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: left 0.2s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  margin-bottom: 24px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: block;
  padding: 7px 10px 7px 12px;
  border-radius: var(--r);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: color var(--t), background var(--t), border-color var(--t);
  border-left: 2px solid transparent;
}

.nav-item:hover {
  color: var(--text-sub);
  background: var(--surface);
}

.nav-item.active {
  color: var(--text);
  background: var(--surface);
  border-left-color: var(--accent);
  padding-left: 10px;
}

.sidebar-bottom {
  padding-top: 14px;
  border-top: 1px solid var(--border);
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-theme-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--r);
  text-align: left;
  transition: color var(--t), background var(--t);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font);
  width: 100%;
}
.sidebar-theme-btn:hover { color: var(--text-sub); background: var(--surface); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
}

.sidebar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user-info { min-width: 0; flex: 1; }

.sidebar-user-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  background: none;
  border: none;
  font-size: 0.7rem;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
  transition: color var(--t);
  font-family: var(--font);
  display: block;
  margin-top: 2px;
  text-align: left;
}
.sidebar-logout:hover { color: var(--red); }

/* ══════════════════════════════════════════════
   PAGE CONTENT — offset by sidebar width
══════════════════════════════════════════════ */
.page-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 40px 48px 60px;
}

/* ── SECTION LABELS ──────────────────────────── */
.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* ── CARDS ───────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}

/* ── BUTTONS ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r);
  border: none;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--t);
  white-space: nowrap;
  cursor: pointer;
  outline: none;
}

.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { opacity: 0.86; }

.btn-ghost {
  background: transparent;
  color: var(--text-sub);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); border-color: var(--border-2); color: var(--text); }

.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { opacity: 0.85; }

.btn-sm { padding: 5px 11px; font-size: 0.78rem; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.btn:disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }

/* ── BADGES ──────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-accent  { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.badge-green   { background: var(--green-dim);  color: var(--green);  border: 1px solid var(--green-border); }
.badge-red     { background: var(--red-dim);    color: var(--red);    border: 1px solid var(--red-border); }
.badge-yellow  { background: var(--yellow-dim); color: var(--yellow); border: 1px solid var(--yellow-border); }
.badge-muted   { background: var(--surface-2);  color: var(--text-dim); border: 1px solid var(--border); }

.badge-diff-easy   { background: var(--green-dim);  color: var(--green);  border: 1px solid var(--green-border); }
.badge-diff-medium { background: var(--yellow-dim); color: var(--yellow); border: 1px solid var(--yellow-border); }
.badge-diff-hard   { background: var(--red-dim);    color: var(--red);    border: 1px solid var(--red-border); }
.badge-num  { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.badge-year { background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border); }
.badge-type { background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border); }

/* ── CHIPS ───────────────────────────────────── */
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }

.chip {
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--t);
  user-select: none;
}
.chip:hover { border-color: var(--border-2); color: var(--text-sub); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── INPUTS ──────────────────────────────────── */
input, select, textarea {
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 10px;
  outline: none;
  transition: border-color var(--t);
  width: 100%;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-dim); }
select { cursor: pointer; }
select option { background: var(--surface); color: var(--text); }

/* ── PROGRESS BAR ────────────────────────────── */
.progress-track { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill  { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.6s ease; }

/* ── TOAST ───────────────────────────────────── */
.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  padding: 10px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid;
  border-radius: var(--r);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  z-index: 9999;
  animation: slideIn 0.18s ease;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  max-width: 280px;
}
.toast-success { border-left-color: var(--green); }
.toast-error   { border-left-color: var(--red); }
.toast-info    { border-left-color: var(--accent); }

/* ── SKELETON + SPINNER ──────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--hover) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r);
}

.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  margin: 0 auto 10px;
}

/* ── ANIMATIONS ──────────────────────────────── */
@keyframes slideIn  { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeUp   { from { opacity: 0; transform: translateY(6px); }  to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer  { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes spin     { to { transform: rotate(360deg); } }

.animate-in { animation: fadeUp 0.22s ease forwards; }

/* ── MOBILE BAR ──────────────────────────────── */
.mobile-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 48px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.mobile-bar-logo { font-size: 0.9rem; font-weight: 700; color: var(--text); }

.mobile-menu-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-sub);
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
}

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ══════════════════════════════════════════════
   MOBILE RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Hide sidebar off-screen on mobile */
  .sidebar { left: calc(-1 * var(--sidebar-w)); box-shadow: none; }
  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 32px rgba(0,0,0,0.6);
  }

  /* Remove sidebar offset */
  .page-content { margin-left: 0; padding: 0 16px 40px; }

  /* Show mobile top bar */
  .mobile-bar { display: flex; }
}
