/* =============================================
   STUDY QUEST — Stylesheet
   ============================================= */

:root {
  --bg:       #080f0f;
  --surface:  #0e1a1a;
  --surface2: #152222;
  --border:   #1f3333;
  --accent:   #00e5a0;
  --accent2:  #00b37a;
  --warn:     #ffcc00;
  --text:     #d4f0e8;
  --muted:    #5a8a7a;
  --radius:   10px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  padding: 1.25rem 2rem;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

h1 {
  font-family: 'Orbitron', monospace;
  font-size: 2rem;
  color: var(--text);
  letter-spacing: 0.05em;
}

h1 .accent { color: var(--accent); }

.tagline {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

/* ── XP Panel ───────────────────────────────── */
.xp-panel {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.level-badge {
  font-family: 'Orbitron', monospace;
  font-size: 1.4rem;
  color: var(--warn);
  background: var(--surface2);
  border: 2px solid var(--warn);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  white-space: nowrap;
}

.xp-track {
  min-width: 220px;
}

.xp-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.xp-labels strong {
  color: var(--accent);
}

.xp-bar-bg {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  height: 12px;
  overflow: hidden;
}

/*
  The progress bar fill doesn't seem to be showing up,
  even though the JS is updating it.
*/
.xp-bar-fill {
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  border-radius: 20px;
  height: 100%;
  width: var(--fill-pct, 0%);   /* BUG: second 'height' overrides first — should be width */
  transition: width 0.4s ease;
}

/* ── Layout ─────────────────────────────────── */
main {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* ── Panels ─────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.panel:last-child { margin-bottom: 0; }

.panel-title {
  font-family: 'Orbitron', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

/* ── Forms ──────────────────────────────────── */
.field {
  margin-bottom: 0.9rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="number"],
select {
  display: block;
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s;
}

input[type="color"] {
  display: block;
  width: 100%;
  height: 40px;
  padding: 0.25rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-primary {
  width: 100%;
  padding: 0.7rem;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-primary:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

/* ── Subject List ───────────────────────────── */
#subject-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.subject-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  background: var(--surface2);
  border-radius: 8px;
  border-left: 4px solid var(--subject-color, var(--accent));
  font-size: 0.9rem;
}

.subject-item span {
  font-weight: 500;
}

.subject-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  transition: color 0.15s;
}

.subject-delete:hover { color: #ff6b6b; }

/* ── Session History ────────────────────────── */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.history-header .panel-title { margin-bottom: 0; }

.history-header select {
  width: auto;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
}

#session-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.session-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--surface2);
  border-radius: 8px;
  border-left: 4px solid var(--subject-color, var(--accent));
}

.session-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--subject-color, var(--accent));
  flex-shrink: 0;
}

.session-info {
  flex: 1;
}

.session-subject-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.session-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.session-meta {
  text-align: right;
  flex-shrink: 0;
}

.session-xp {
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  color: var(--accent);
}

.session-duration {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
  font-size: 0.9rem;
}

/* ── Responsive Mobile Layout ───────────────────────── */
@media (max-width: 768px) {
  main {
    grid-template-columns: 1fr;
  }

  .header-inner {
    justify-content: center;
    text-align: center;
  }

  .sidebar,
  .main-col {
    width: 100%;
  }

  .sidebar {
    order: 1;
  }

  .main-col {
    order: 2;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .history-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .history-header select {
    width: 100%;
  }
}
