@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Mono:wght@300;400&display=swap');

:root {
  --bg:         #07080f;
  --surface:    #0e1018;
  --border:     #1e2130;
  --accent:     #4f6ef7;
  --accent2:    #7c3aed;
  --text:       #e8eaf2;
  --muted:      #5a5f7a;
  --ai-color:   #4f6ef7;
  --cand-color: #10b981;
  --danger:     #ef4444;
  --radius:     14px;
  --glow:       0 0 40px rgba(79,110,247,0.15);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Syne', sans-serif;
  overflow: hidden;
}

/* ── SCREENS ───────────────────────────────────────────────────────────────── */
.screen { display: none; height: 100vh; overflow-y: auto; }
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ── SETUP ─────────────────────────────────────────────────────────────────── */
#setup-screen { background: radial-gradient(ellipse at 60% 0%, #1a1f3c 0%, var(--bg) 60%); }

.setup-card {
  width: min(600px, 94vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px 40px;
  box-shadow: var(--glow);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 28px;
}
.logo.small { margin-bottom: 0; font-size: 0.95rem; }
.logo-icon { width: 32px; height: 32px; }

h1 { font-size: 2rem; font-weight: 800; line-height: 1.15; margin-bottom: 10px; }
.subtitle { color: var(--muted); font-size: 0.93rem; line-height: 1.6; margin-bottom: 32px; font-family: 'DM Mono', monospace; font-weight: 300; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 8px; }
.form-group textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  font-weight: 300;
  padding: 14px 16px;
  resize: vertical;
  line-height: 1.6;
  transition: border-color 0.2s;
}
.form-group textarea:focus { outline: none; border-color: var(--accent); }
.form-group textarea::placeholder { color: var(--muted); }

/* ── BUTTONS ───────────────────────────────────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-primary svg { width: 18px; height: 18px; }
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-danger {
  padding: 8px 18px;
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 8px;
  font-family: 'Syne', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-danger:hover { background: rgba(239,68,68,0.1); }

/* ── INTERVIEW SCREEN ──────────────────────────────────────────────────────── */
#interview-screen { display: none; flex-direction: column; overflow: hidden; }
#interview-screen.active { display: flex; }

.interview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.state-badge {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 5px 14px;
  border-radius: 100px;
  border: 1px solid;
  font-family: 'DM Mono', monospace;
  transition: all 0.3s;
}
.state-badge.idle       { color: var(--muted);      border-color: var(--muted); }
.state-badge.ai_speaking{ color: var(--ai-color);   border-color: var(--ai-color);   background: rgba(79,110,247,0.08); }
.state-badge.listening  { color: var(--cand-color); border-color: var(--cand-color); background: rgba(16,185,129,0.08); }
.state-badge.processing { color: #f59e0b;           border-color: #f59e0b;           background: rgba(245,158,11,0.08); }
.state-badge.ended      { color: var(--muted);      border-color: var(--muted); }

.interview-body {
  display: grid;
  grid-template-columns: 1fr 380px;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

/* ── VISUALIZER ────────────────────────────────────────────────────────────── */
.visualizer-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 40px;
  position: relative;
  background: radial-gradient(ellipse at center, #0d1020 0%, var(--bg) 70%);
}

.ai-avatar { position: relative; width: 140px; height: 140px; display: flex; align-items: center; justify-content: center; }

.avatar-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(79,110,247,0.25);
  transition: all 0.4s ease;
}
.ring1 { width: 100%; height: 100%; }
.ring2 { width: 130%; height: 130%; border-color: rgba(79,110,247,0.15); }
.ring3 { width: 160%; height: 160%; border-color: rgba(79,110,247,0.07); }

/* Pulsing when AI speaks */
.ai-speaking .ring1 { animation: pulse 1.4s ease-in-out infinite; border-color: rgba(79,110,247,0.5); }
.ai-speaking .ring2 { animation: pulse 1.4s ease-in-out 0.2s infinite; }
.ai-speaking .ring3 { animation: pulse 1.4s ease-in-out 0.4s infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.08); opacity: 0.7; }
}

.avatar-core {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, rgba(79,110,247,0.2), rgba(124,58,237,0.2));
  border: 1px solid rgba(79,110,247,0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  z-index: 1;
}
.avatar-core svg { width: 40px; height: 40px; }

/* Mic bars */
.mic-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.3s;
}
.mic-indicator.active { opacity: 1; }
.mic-indicator span { font-size: 0.75rem; color: var(--cand-color); font-family: 'DM Mono', monospace; letter-spacing: 0.08em; }

.mic-bars { display: flex; align-items: flex-end; gap: 4px; height: 28px; }
.mic-bars .bar {
  width: 4px;
  background: var(--cand-color);
  border-radius: 2px;
  height: 6px;
  animation: bar-bounce 0.8s ease-in-out infinite;
}
.mic-bars .bar:nth-child(1) { animation-delay: 0s; }
.mic-bars .bar:nth-child(2) { animation-delay: 0.12s; }
.mic-bars .bar:nth-child(3) { animation-delay: 0.24s; }
.mic-bars .bar:nth-child(4) { animation-delay: 0.36s; }
.mic-bars .bar:nth-child(5) { animation-delay: 0.48s; }

@keyframes bar-bounce {
  0%, 100% { height: 6px; }
  50%       { height: 22px; }
}

.live-caption {
  font-family: 'DM Mono', monospace;
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
  max-width: 400px;
  min-height: 24px;
  line-height: 1.5;
  font-weight: 300;
  font-style: italic;
  transition: color 0.2s;
}
.live-caption.ai-text { color: var(--text); font-style: normal; }

/* ── TRANSCRIPT ────────────────────────────────────────────────────────────── */
.transcript-panel {
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow: hidden;
}

.transcript-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}
.q-count { color: var(--muted); font-family: 'DM Mono', monospace; }

.transcript-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.transcript-list::-webkit-scrollbar { width: 4px; }
.transcript-list::-webkit-scrollbar-track { background: transparent; }
.transcript-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.transcript-msg {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.83rem;
  line-height: 1.6;
  animation: fadein 0.3s ease;
  font-family: 'DM Mono', monospace;
  font-weight: 300;
}
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.transcript-msg.ai {
  background: rgba(79,110,247,0.08);
  border: 1px solid rgba(79,110,247,0.18);
  border-bottom-left-radius: 4px;
}
.transcript-msg.candidate {
  background: rgba(16,185,129,0.07);
  border: 1px solid rgba(16,185,129,0.15);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  width: 95%;
}
.transcript-msg .msg-role {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 5px;
}
.transcript-msg.ai .msg-role       { color: var(--ai-color); }
.transcript-msg.candidate .msg-role{ color: var(--cand-color); }

/* ── SUMMARY SCREEN ────────────────────────────────────────────────────────── */
#summary-screen { background: radial-gradient(ellipse at 40% 0%, #1a1f3c 0%, var(--bg) 60%); justify-content: flex-start; padding: 40px 20px; }

.summary-wrap {
  width: min(820px, 96vw);
  margin: 0 auto;
}

.summary-header { text-align: center; margin-bottom: 36px; }
.summary-header h2 { font-size: 2rem; font-weight: 800; margin: 16px 0 12px; }

.recommendation-badge {
  display: inline-block;
  padding: 6px 20px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: rgba(79,110,247,0.1);
  font-family: 'DM Mono', monospace;
}

.scores-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.score-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
}
.score-num {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent);
  font-family: 'DM Mono', monospace;
  line-height: 1;
  margin-bottom: 8px;
}
.score-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.summary-body { display: flex; flex-direction: column; gap: 20px; margin-bottom: 32px; }
.summary-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.summary-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.summary-section h3 { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin-bottom: 14px; }
.summary-section p { font-family: 'DM Mono', monospace; font-size: 0.87rem; font-weight: 300; color: var(--text); line-height: 1.7; }
.summary-section ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.summary-section ul li {
  font-family: 'DM Mono', monospace;
  font-size: 0.83rem;
  font-weight: 300;
  color: var(--text);
  line-height: 1.5;
  padding-left: 16px;
  position: relative;
}
.summary-section ul li::before { content: '→'; position: absolute; left: 0; color: var(--accent); }

@media (max-width: 680px) {
  .interview-body { grid-template-columns: 1fr; }
  .transcript-panel { border-left: none; border-top: 1px solid var(--border); max-height: 240px; }
  .scores-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-cols { grid-template-columns: 1fr; }
}
