/* =========================================================
   INTERVIEW PREP HUB — Design tokens
   Concept: a late-night "study desk" — a focused workspace
   with a warm desk-lamp accent (amber) against deep ink,
   and a cool signal-blue for progress/data. Streak = flame,
   the one warm accent used sparingly and meaningfully.
   ========================================================= */

:root {
  --bg: #F3F1EC;
  --bg-soft: #ECE8DF;
  --surface: #FFFFFF;
  --surface-border: #DEDACD;
  --ink: #1B1A17;
  --ink-soft: #6B675C;
  --accent: #2F5D8A;       /* signal blue - progress, primary actions */
  --accent-soft: #E4ECF3;
  --flame: #E08A3E;         /* streak / warm highlight, used sparingly */
  --flame-soft: #FBEADA;
  --good: #3F8557;
  --good-soft: #E4F1E8;
  --danger: #B84C3E;
  --danger-soft: #F6E5E2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27,26,23,0.04), 0 8px 24px rgba(27,26,23,0.06);
  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="dark"] {
  --bg: #14151A;
  --bg-soft: #1B1D24;
  --surface: #1F212A;
  --surface-border: #2C2F3A;
  --ink: #EDECE7;
  --ink-soft: #9A9CA8;
  --accent: #6FA8DC;
  --accent-soft: #23364A;
  --flame: #F0A05C;
  --flame-soft: #3A2A1C;
  --good: #6FBE8A;
  --good-soft: #1F332A;
  --danger: #E08678;
  --danger-soft: #3A2320;
  --shadow: 0 1px 2px rgba(0,0,0,0.2), 0 12px 30px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  scroll-behavior: smooth;
}

button, textarea, input {
  font-family: inherit;
}

::selection { background: var(--accent-soft); color: var(--accent); }

h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0 0 6px 0;
  letter-spacing: -0.01em;
}

.muted { color: var(--ink-soft); font-size: 0.92rem; }
.hidden { display: none !important; }

/* ================= APP SHELL ================= */
.app-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

/* ================= SIDEBAR ================= */
.sidebar {
  background: var(--bg-soft);
  border-right: 1px solid var(--surface-border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 6px 22px 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
}
.brand-mark {
  font-family: var(--font-mono);
  color: var(--flame);
  font-size: 0.95rem;
}
.brand-text em { color: var(--accent); font-style: normal; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.93rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-icon {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  width: 18px;
  text-align: center;
  color: var(--ink-soft);
}
.nav-btn:hover { background: var(--surface); color: var(--ink); }
.nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-btn.active .nav-icon { color: var(--accent); }

.sidebar-footer { padding-top: 12px; border-top: 1px solid var(--surface-border); }
.theme-toggle {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.theme-toggle:hover { border-color: var(--accent); }

/* ================= MAIN ================= */
.main { padding: 28px 36px 60px 36px; max-width: 980px; }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 26px;
  gap: 16px;
  flex-wrap: wrap;
}
.subtitle { margin: 0; color: var(--ink-soft); }

.streak-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--flame-soft);
  border: 1px solid var(--flame);
  padding: 10px 16px;
  border-radius: 12px;
}
.flame { font-size: 1.4rem; }
.streak-text { display: flex; flex-direction: column; line-height: 1.1; }
.streak-text strong { font-family: var(--font-display); font-size: 1.15rem; color: var(--flame); }
.streak-text span { font-size: 0.75rem; color: var(--ink-soft); }

/* ================= PAGES ================= */
.page { display: none; animation: fadeIn 0.25s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ================= CARDS ================= */
.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

/* ================= DASHBOARD ================= */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 0.78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--accent); }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 20px;
  margin-bottom: 20px;
}

.ring-wrap { position: relative; width: 140px; height: 140px; margin: 10px auto 0 auto; }
.progress-ring { transform: rotate(-90deg); width: 140px; height: 140px; }
.ring-bg { fill: none; stroke: var(--bg-soft); stroke-width: 12; }
.ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 377;
  stroke-dashoffset: 377;
  transition: stroke-dashoffset 0.6s ease;
}
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-center span { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
.ring-center small { color: var(--ink-soft); font-size: 0.75rem; }

.quick-links { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.quick-link {
  text-align: left;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  background: var(--bg-soft);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.quick-link:hover { border-color: var(--accent); transform: translateX(2px); }

/* ================= BUTTONS ================= */
.btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--surface-border); color: var(--ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
.btn:hover:not(:disabled) { opacity: 0.88; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ================= CODING PAGE ================= */
.challenge-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tag {
  background: var(--flame-soft);
  color: var(--flame);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}
.problem-desc { font-size: 1rem; line-height: 1.6; }
.example-box {
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 14px;
}
.example-box strong { font-size: 0.78rem; text-transform: uppercase; color: var(--ink-soft); }
.example-box pre { font-family: var(--font-mono); font-size: 0.85rem; margin: 8px 0 0 0; white-space: pre-wrap; }
.hint { background: var(--accent-soft); color: var(--accent); padding: 12px 14px; border-radius: 10px; margin-top: 14px; }

/* ================= APTITUDE QUIZ ================= */
.quiz-progress-bar { height: 6px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; margin-bottom: 14px; }
.quiz-progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.3s ease; }
.options { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.option-btn {
  text-align: left;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  background: var(--bg-soft);
  cursor: pointer;
  font-size: 0.94rem;
  color: var(--ink);
}
.option-btn:hover { border-color: var(--accent); }
.option-btn.correct { background: var(--good-soft); border-color: var(--good); color: var(--good); font-weight: 600; }
.option-btn.wrong { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); font-weight: 600; }
.option-btn:disabled { cursor: default; }
.big-score { font-family: var(--font-display); font-size: 2.2rem; color: var(--accent); font-weight: 700; }

/* ================= ACCORDION (HR / Technical) ================= */
.accordion { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.accordion-item {
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  overflow: hidden;
}
.accordion-q {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: var(--bg-soft);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.94rem;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.accordion-q .cat-tag { font-size: 0.7rem; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 10px; font-weight: 700; text-transform: uppercase; }
.accordion-a {
  max-height: 0;
  overflow: hidden;
  padding: 0 16px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.6;
  transition: max-height 0.25s ease, padding 0.25s ease;
}
.accordion-item.open .accordion-a { max-height: 300px; padding: 4px 16px 16px 16px; }
.accordion-item.open .accordion-q { color: var(--accent); }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--surface-border);
  background: var(--bg-soft);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ================= RESUME CHECKLIST ================= */
.checklist-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.checklist { display: flex; flex-direction: column; gap: 8px; }
.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--surface-border);
  cursor: pointer;
}
.check-item input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.check-item span { font-size: 0.92rem; }
.check-item.done span { text-decoration: line-through; color: var(--ink-soft); }

/* ================= NOTES ================= */
#noteInput {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  background: var(--bg-soft);
  color: var(--ink);
  resize: vertical;
  font-size: 0.92rem;
  margin-bottom: 12px;
}
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.note-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  position: relative;
}
.note-card p { font-size: 0.9rem; margin: 0 0 10px 0; white-space: pre-wrap; }
.note-date { font-size: 0.72rem; color: var(--ink-soft); }
.note-delete {
  position: absolute;
  top: 10px; right: 10px;
  background: none; border: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.9rem;
}
.note-delete:hover { color: var(--danger); }

/* ================= RESPONSIVE ================= */
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-footer { border-top: none; padding-top: 0; margin-left: auto; }
  .main { padding: 20px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Visible keyboard focus */
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}