/* interview.css — Web mock interview page */
/* Tokens mirror DESIGN.md (Skilark Evolved) — same as interviews.html */

:root {
  --bg:              #FAFAFA;
  --surface:         #FFFFFF;
  --header-bg:       #FFFFFF;
  --border:          #e5edf5;
  --divider:         #F3F4F6;
  --text-primary:    #061b31;
  --text-secondary:  #64748d;
  --text-muted:      #94a3b8;
  --accent:          #6366F1;
  --accent-light:    rgba(99, 102, 241, 0.06);
  --accent-mid:      #C7D2FE;
  --accent-hover:    #4F46E5;
  --shadow-card:     rgba(50,50,93,0.08) 0px 4px 10px -2px, rgba(0,0,0,0.03) 0px 2px 4px -2px;
  --shadow-elevated: rgba(50,50,93,0.15) 0px 8px 20px -4px, rgba(0,0,0,0.08) 0px 4px 8px -4px;
  --shadow-header:   0 1px 0 var(--border);
  --input-bg:        #FFFFFF;
  --input-border:    #e5edf5;
  --error-color:     #DC2626;
  --error-bg:        rgba(220, 38, 38, 0.08);
  --success-color:   #16A34A;
  --success-bg:      rgba(22, 163, 74, 0.10);
  --radius-card:     10px;
  --radius-btn:      8px;
  --radius-input:    8px;
  --ease:            cubic-bezier(.2, .8, .2, 1);
  --nav-h:           56px;
}

[data-theme="dark"] {
  --bg:              #0f1114;
  --surface:         #191b22;
  --header-bg:       #141620;
  --border:          rgba(255, 255, 255, 0.07);
  --divider:         rgba(255, 255, 255, 0.05);
  --text-primary:    #f0f0f3;
  --text-secondary:  #9ca0ae;
  --text-muted:      #6b6f80;
  --accent:          #818CF8;
  --accent-light:    rgba(129, 140, 248, 0.06);
  --accent-mid:      rgba(129, 140, 248, 0.25);
  --accent-hover:    #6366F1;
  --shadow-card:     rgba(50,50,93,0.12) 0px 4px 10px -2px, rgba(0,0,0,0.18) 0px 2px 4px -2px;
  --shadow-elevated: rgba(50,50,93,0.25) 0px 12px 30px -6px, rgba(0,0,0,0.30) 0px 6px 12px -4px;
  --input-bg:        rgba(255, 255, 255, 0.03);
  --input-border:    rgba(255, 255, 255, 0.08);
  --error-color:     #F87171;
  --error-bg:        rgba(248, 113, 113, 0.10);
  --success-color:   #4ADE80;
  --success-bg:      rgba(74, 222, 128, 0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  font-size: 14px; line-height: 1.5;
  color: var(--text-primary); background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background .2s var(--ease), color .2s var(--ease);
}

/* ── Header ── */
.header {
  position: sticky; top: 0; z-index: 100; height: var(--nav-h);
  background: var(--header-bg); box-shadow: var(--shadow-header);
  display: flex; align-items: center;
  padding: 0 clamp(16px, 4vw, 32px);
}
.header-inner {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%;
}
.logo {
  font-family: 'JetBrains Mono', monospace; font-weight: 700;
  font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-primary); text-decoration: none;
}
.logo .ark { color: #F97316; }

/* Nav tabs — center column */
.header-nav {
  display: flex; gap: 4px; justify-self: center;
}
.header-nav .tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); text-decoration: none;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.header-nav .tab:hover { color: var(--text-primary); background: var(--accent-light); }
.header-nav .tab.active { color: var(--accent); background: var(--accent-light); }

/* Right cluster — theme toggle (+ avatar/resume-chip hidden during live state) */
.header-right {
  display: flex; gap: 10px; align-items: center; justify-self: end;
}

.theme-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); padding: 6px; border-radius: 6px;
  display: flex; align-items: center; transition: color .15s var(--ease);
}
.theme-btn:hover { color: var(--text-primary); background: var(--accent-light); }

/* Hide nav and right chrome during live state — focused mode.
   The live state relies on its own minimal live-header (meta + timer). */
#live:not([hidden]) ~ .header .header-nav,
.live-active .header-nav,
.live-active .header-right .resume-chip,
.live-active .header-right .avatar { display: none; }

/* ── Page layout ── */
.page {
  max-width: 640px; margin: 0 auto;
  padding: clamp(24px, 5vw, 48px) clamp(16px, 4vw, 32px);
}

/* ── Lobby state ── */
#lobby .interview-type-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-light); color: var(--accent);
  font-size: 12px; font-weight: 600; padding: 4px 10px;
  border-radius: 9999px; margin-bottom: 12px;
  text-transform: uppercase; letter-spacing: 0.06em;
}

#lobby h1 {
  font-size: clamp(20px, 3vw, 26px); font-weight: 700;
  color: var(--text-primary); margin-bottom: 6px;
}

#lobby-meta {
  color: var(--text-secondary); font-size: 14px; margin-bottom: 28px;
}

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-card);
  padding: 20px 24px; margin-bottom: 16px;
}

.card-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px;
}

/* Mic bar — use token gradient so it adapts in dark mode */
.mic-bar-track {
  height: 8px; background: var(--divider); border-radius: 9999px;
  overflow: hidden; margin-bottom: 10px;
}
.mic-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-mid));
  border-radius: 9999px;
  transition: width 60ms linear;
}

#mic-status {
  font-size: 13px; color: var(--text-secondary);
}

/* Legal microcopy under lobby actions */
.lobby-consent {
  font-size: 12px; color: var(--text-muted);
  margin-top: 12px; line-height: 1.4;
}

/* Unsupported browser notice */
.compat-warning {
  background: var(--error-bg); color: var(--error-color);
  border: 1px solid currentColor; border-radius: var(--radius-card);
  padding: 14px 18px; font-size: 13px; margin-bottom: 16px;
}

/* Mic error panel */
.mic-error {
  background: var(--error-bg); border: 1px solid var(--error-color);
  border-radius: var(--radius-card); padding: 14px 18px;
  font-size: 13px; color: var(--error-color);
}
.mic-error p { margin-bottom: 10px; }
.mic-error-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-btn);
  padding: 10px 20px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s var(--ease);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-btn);
  padding: 10px 20px; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .15s var(--ease);
}
.btn-secondary:hover { color: var(--text-primary); border-color: var(--accent); }

.btn-ghost {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  padding: 4px 0; text-decoration: underline; text-underline-offset: 3px;
  transition: color .15s var(--ease);
}
.btn-ghost:hover { color: var(--text-primary); }

.lobby-actions {
  display: flex; gap: 10px; align-items: center; margin-top: 20px; flex-wrap: wrap;
}

/* ── Live state ── */
#live {
  display: flex; flex-direction: column;
  /* 100dvh for iOS Safari URL-bar-safe viewport height */
  height: calc(100dvh - var(--nav-h));
  padding: clamp(12px, 3vw, 24px);
  max-width: 800px; margin: 0 auto; width: 100%;
}

.live-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; flex-shrink: 0;
}

#live-meta {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
}

#live-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.live-timer-warning { color: var(--error-color) !important; }

/* Waveform canvas */
#waveform {
  display: block; width: 100%; height: 80px;
  border-radius: var(--radius-card); background: var(--surface);
  border: 1px solid var(--border); flex-shrink: 0; margin-bottom: 12px;
}

/* AI status indicator */
.ai-status {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  font-size: 13px; color: var(--text-secondary); flex-shrink: 0;
}
.ai-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted); flex-shrink: 0;
  transition: background .2s var(--ease);
}
/* Speaking: indigo pulse — per DESIGN.md "mocks use --accent" */
.ai-status-dot.speaking { background: var(--accent); animation: interview-pulse 1s ease-in-out infinite; }
/* Listening: steady indigo — neutral state; green = success is reserved semantic */
.ai-status-dot.listening { background: var(--accent); }
.ai-status-dot.disconnected { background: var(--text-muted); }

@keyframes interview-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Caption area */
.captions {
  flex: 1; overflow-y: auto; min-height: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 2px 0; margin-bottom: 12px;
}

.caption-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px; line-height: 1.5;
}
/* Light mode: low-alpha tints are visible against white/near-white bg */
.caption-bubble.ai {
  background: var(--accent-light); color: var(--text-primary);
  border-bottom-left-radius: 4px; align-self: flex-start;
}
.caption-bubble.user {
  background: var(--divider); color: var(--text-primary);
  border-bottom-right-radius: 4px; align-self: flex-end;
}
/* Dark mode: --accent-light (0.06 alpha) and --divider (0.05 alpha) vanish
   against the dark bg — override with visible surface-based values. */
[data-theme="dark"] .caption-bubble.ai {
  background: var(--accent-mid);
}
[data-theme="dark"] .caption-bubble.user {
  background: var(--surface); border: 1px solid var(--border);
}

/* Live footer */
.live-footer {
  display: flex; gap: 10px; align-items: center; flex-shrink: 0;
  padding-top: 10px; border-top: 1px solid var(--border);
}

.btn-mute {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-btn); padding: 9px 16px;
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  cursor: pointer; transition: all .15s var(--ease);
}
.btn-mute:hover { border-color: var(--accent); color: var(--accent); }
.btn-mute.muted { background: var(--error-bg); border-color: var(--error-color); color: var(--error-color); }

.btn-end {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--error-bg); border: 1px solid var(--error-color);
  border-radius: var(--radius-btn); padding: 9px 16px;
  font-size: 13px; font-weight: 600; color: var(--error-color);
  cursor: pointer; transition: all .15s var(--ease); margin-left: auto;
}
/* Swap to solid only on active — hover stays outlined so a stray hover on
   mobile doesn't read as "activating"; deliberate tap required. */
.btn-end:hover { background: var(--error-bg); }
.btn-end:active { background: var(--error-color); color: #fff; }

/* ── Post state ── */
#post {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: calc(100dvh - var(--nav-h));
  padding: clamp(24px, 5vw, 48px) clamp(16px, 4vw, 32px);
  text-align: center;
}

.post-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent-light); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}

#post h2 {
  font-size: 20px; font-weight: 700; margin-bottom: 8px;
}

#post-message {
  color: var(--text-secondary); font-size: 14px; margin-bottom: 24px;
}

.post-hint {
  color: var(--text-muted); font-size: 12px;
}

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite; display: inline-block;
  vertical-align: middle; margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile ── */
@media (max-width: 480px) {
  /* At narrow widths the meta string (e.g. "Behavioral · google") + timer
     collide — drop meta, keep timer which is the essential live signal. */
  #live-meta { display: none; }
  .live-footer { padding-top: 8px; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   technical_coding split layout — Phase 2 Monaco embed
   ══════════════════════════════════════════════════════════════════════════════ */

/* Full-viewport grid: HUD top row, then problem / editor side-by-side */
.live-shell {
  display: grid;
  grid-template-rows: 56px auto 1fr;
  grid-template-columns: 40% 60%;
  grid-template-areas:
    "hud      hud"
    "banner   banner"
    "problem  editor";
  height: 100vh;
  overflow: hidden;
}

/* Compact audio HUD across the full top */
.audio-hud {
  grid-area: hud;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.audio-hud .hud-status {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.captions-ticker {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  color: var(--text-secondary);
}

.audio-hud .controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.coding-end {
  font-size: 12px;
  padding: 4px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.coding-end:hover { background: var(--accent-hover); }

/* Degraded-mode banner spans both columns below the HUD */
.degraded-banner {
  grid-area: banner;
  padding: 6px 16px;
  font-size: 13px;
  color: #fff;
  background: #f59e0b;  /* amber warning — not yet a CSS var, acceptable for v2 */
  z-index: 10;
}

.degraded-banner[data-severity="info"] { background: var(--accent); }

/* Problem pane — left column */
.problem-pane {
  grid-area: problem;
  overflow-y: auto;
  padding: 20px 16px;
  border-right: 1px solid var(--border);
}

.problem-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 40px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

.problem-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.problem-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Editor pane — right column */
.editor-pane {
  grid-area: editor;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.lang-select {
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-primary);
  cursor: pointer;
}

.btn-share {
  font-size: 12px;
  padding: 4px 12px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-mid);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-share:hover { background: var(--accent-light); }

.btn-share.shared {
  color: #22c55e;
  border-color: #86efac;
}

/* Editor mount container fills remaining height */
.editor-mount {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Loading skeleton shown until Monaco mounts */
.editor-mount-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg);
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  z-index: 5;
}

.editor-mount-loading::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent-mid);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* Below-768px: show desktop-required banner, hide coding layout */
@media (max-width: 767.98px) {
  .live-shell { display: none !important; }
  .desktop-required { display: flex !important; }
}

.desktop-required {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
  min-height: 60vh;
}

/* ── Utility ── */
[hidden] { display: none !important; }
