/* Interview history sidebar — shared between static/index.html and the
   standalone report page (report.py's render_html). One stylesheet, one
   script (sidebar.js), loaded by both via <link>/<script src>, so the
   two surfaces can't drift out of sync with each other.

   Assumes the host page defines these tokens on :root: --panel, --line,
   --amber, --cyan, --text, --muted, --mono, --display. Both host pages
   already do (verified: identical names in both, see index.html's :root
   and report.py's render_html :root block).
*/

:root {
  /* Not defined by either host page before this — scores need a
     distinct "good" color the existing dark palette doesn't have. */
  --green: #4ade80;
  --red: #ff6b6b; /* matches the existing Sign out / quota-exhausted red exactly */
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 29;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--text); }
.sidebar-toggle svg { width: 16px; height: 16px; }

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 300px;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--line);
  font-family: var(--display);
  z-index: 30;
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.sidebar-head-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* Self-contained here (not index.html's own .pro-badge/.avatar rules):
   report.py's standalone report page loads this file but not index.html's
   inline <style>, so the sidebar avatar/badge need their own copy to
   render identically on both surfaces. */
/* margin-right, not just the row's own gap: the Pro badge sits at
   right:-2px (see .sidebar-pro-badge below), so it overhangs the
   avatar's own box and would otherwise crowd right up against the
   title text next to it. */
.sidebar-avatar { position: relative; display: inline-flex; flex-shrink: 0; width: 22px; height: 22px; margin-right: 4px; }
.sidebar-avatar img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block;
}
.sidebar-avatar-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--line); color: var(--amber);
  font-family: var(--mono); font-size: 10px; font-weight: 500;
}
.sidebar-pro-badge {
  position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px;
  display: flex; align-items: center; justify-content: center;
  /* Shape comes from the svg itself (Heroicons check-badge) — matches
     .pro-badge in index.html's own <style>, kept in sync by hand since
     this file has no shared token for it. */
  filter: drop-shadow(0 0 1px var(--panel)) drop-shadow(0 0 1px var(--panel));
}
.sidebar-pro-badge svg { width: 100%; height: 100%; }
.sidebar-pro-badge svg { width: 60%; height: 60%; }

.sidebar-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidebar-new {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--amber);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.sidebar-new:hover { border-color: var(--amber); }

/* ── Stats row ─────────────────────────────────────────── */
.sidebar-stats {
  display: flex;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.sidebar-stats .stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sidebar-stats .stat-value {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.sidebar-stats .stat-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Sparkline ─────────────────────────────────────────── */
.sidebar-spark {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.sidebar-spark svg { width: 100%; height: 48px; display: block; }
.sidebar-spark .spark-line {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.sidebar-spark .spark-dot { fill: var(--amber); }

/* ── Search + filter ───────────────────────────────────── */
.sidebar-search { padding: 12px 16px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.sidebar-search input {
  width: 100%;
  font-family: var(--display);
  font-size: 13px;
  color: var(--text);
  background: var(--bg, #0a0b0d);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 10px;
  outline: none;
  box-sizing: border-box;
}
.sidebar-search input:focus { border-color: var(--amber); }
.sidebar-filters { display: flex; gap: 6px; margin-top: 8px; }
.filter-chip {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}
.filter-chip.active { color: var(--amber); border-color: var(--amber); }

/* ── List ──────────────────────────────────────────────── */
.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 8px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--line) 70%, var(--muted) 30%) transparent;
}
.sidebar-list::-webkit-scrollbar { width: 6px; }
.sidebar-list::-webkit-scrollbar-track { background: transparent; }
.sidebar-list::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--line) 70%, var(--muted) 30%);
  border-radius: 999px;
}
.sidebar-list:hover::-webkit-scrollbar-thumb { background: var(--muted); }
.sidebar-list::-webkit-scrollbar-thumb:hover { background: var(--amber); }
.sidebar-group-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px 6px;
}
.sidebar-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px 10px 13px;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.sidebar-card:hover { background: rgba(255, 255, 255, 0.03); }
.sidebar-card.active {
  border-left-color: var(--amber);
  background: rgba(255, 182, 39, 0.06);
}
.card-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.card-role {
  font-size: 13.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-score { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--amber); flex-shrink: 0; }
.card-score.score-good { color: var(--green); }
.card-score.score-bad { color: var(--red); }
.card-status { font-family: var(--mono); font-size: 11px; color: var(--muted); flex-shrink: 0; }
.card-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  text-transform: capitalize;
}

/* ── Empty state ───────────────────────────────────────── */
.sidebar-empty:not([hidden]), .sidebar-signin:not([hidden]) {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 6px;
}
.sidebar-empty p, .sidebar-signin p { margin: 0; }
.sidebar-empty-icon { color: var(--muted); opacity: 0.55; margin-bottom: 4px; }
.sidebar-empty p:first-child { color: var(--text); font-size: 14px; }
.sidebar-empty-sub { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.sidebar-empty-cta {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--amber);
  background: rgba(255, 182, 39, 0.08);
  border: 1px solid var(--amber);
  border-radius: 7px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background-color 0.15s;
}
.sidebar-empty-cta:hover { background: rgba(255, 182, 39, 0.16); }
.sidebar-signin p { color: var(--muted); font-size: 13px; }
.sidebar-signin-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}
.sidebar-signin-cta:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--muted); }

/* ── Footer quota ──────────────────────────────────────── */
.sidebar-foot { padding: 14px 16px 16px; border-top: 1px solid var(--line); flex-shrink: 0; }
/* Same class names as the profile-dropdown quota bar (index.html) — this
   reuses that component rather than inventing a second one. Harmless if
   both stylesheets define it identically; report.py has no other source
   for these classes, so they must live here too. */
.quota-bar-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
.quota-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--amber) 75%, white 10%), var(--amber));
  box-shadow: 0 0 8px color-mix(in srgb, var(--amber) 55%, transparent);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease, box-shadow 0.3s ease;
}
.quota-bar-fill.exhausted {
  background: linear-gradient(90deg, color-mix(in srgb, var(--red) 75%, white 10%), var(--red));
  box-shadow: 0 0 10px color-mix(in srgb, var(--red) 60%, transparent);
}
.sidebar-quota-text {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.sidebar-quota-text .quota-count {
  color: var(--text);
  font-weight: 600;
}

/* ── Layout accommodation on host pages ───────────────────
   Reserves space to the sidebar's right on desktop so it never overlaps
   the centered .room/main card. Both host pages center their main
   content with body-level flex/grid, so padding-left is the least
   invasive way to make room without restructuring either one. */
@media (min-width: 1025px) {
  body.has-sidebar { padding-left: 300px; }
}

/* ── Mobile: off-canvas drawer ─────────────────────────── */
@media (max-width: 1024px) {
  .sidebar-toggle { display: inline-flex; }
  .sidebar {
    width: min(300px, 84vw);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    border-right: 1px solid var(--line);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { display: none; }
  .sidebar-backdrop.open { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
