@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(560px, 94vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--glow);
  max-height: 90vh;
  overflow-y: auto;
}
.setup-card::-webkit-scrollbar { width: 4px; }
.setup-card::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

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

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

/* ── SECTION LABEL ─────────────────────────────────────────────────────────── */
.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ── USER LIST ─────────────────────────────────────────────────────────────── */
.user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.user-loading {
  font-family: 'DM Mono', monospace;
  font-size: 0.82rem;
  color: var(--muted);
  padding: 12px 0;
}

/* ── USER CARD ─────────────────────────────────────────────────────────────── */
.user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 0;
}
.user-card:hover { border-color: rgba(79,110,247,0.4); background: rgba(79,110,247,0.04); }
.user-card.selected { border-color: var(--accent); background: rgba(79,110,247,0.08); }

.user-card.new-customer {
  margin-top: 8px;
  margin-bottom: 20px;
  border-style: dashed;
}
.user-card.new-customer .user-card-avatar.new {
  background: rgba(79,110,247,0.1);
  border: 1px dashed rgba(79,110,247,0.3);
  color: var(--accent);
  font-size: 1.2rem;
}

.user-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(79,110,247,0.3), rgba(124,58,237,0.3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.user-card-info { flex: 1; min-width: 0; }

.user-card-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-meta {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-tag {
  display: inline-block;
  margin-top: 5px;
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--cand-color);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 4px;
  padding: 1px 7px;
}

/* ── 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;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-primary svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.35; 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); }

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

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

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  color: var(--cand-color);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 6px;
  padding: 3px 10px;
  white-space: nowrap;
}

.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;
  white-space: nowrap;
}
.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: minmax(240px, 1fr) minmax(300px, 460px);
  flex: 1;
  overflow: hidden;
}

/* ── VISUALIZER ────────────────────────────────────────────────────────────── */
.visualizer-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 40px;
  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); }

.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-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; }
}

/* ── 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: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  flex-shrink: 0;
}
.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-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; align-self: flex-start; max-width: 95%;
}
.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; max-width: 95%;
}
.transcript-msg.streaming { opacity: 0.92; }
.transcript-msg.streaming .msg-content { font-style: italic; color: var(--muted); }
.transcript-msg.streaming.ai .msg-content { color: var(--text); font-style: italic; }

.msg-role {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); margin-bottom: 4px;
}
.transcript-msg.ai .msg-role        { color: var(--ai-color); }
.transcript-msg.candidate .msg-role { color: var(--cand-color); }

/* ── CONFIRMATION SCREEN ───────────────────────────────────────────────────── */
.summary-wrap { width: min(520px, 96vw); margin: 0 auto; padding: 24px 0; }

.summary-header { text-align: center; margin-bottom: 28px; }
.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;
}

/* ── BOOKING CARD ──────────────────────────────────────────────────────────── */
.booking-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 24px;
}
.booking-row {
  display: flex; align-items: baseline; gap: 16px;
  padding: 15px 22px; border-bottom: 1px solid var(--border);
}
.booking-row:last-child { border-bottom: none; }
.booking-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); min-width: 130px; flex-shrink: 0;
}
.booking-value {
  font-family: 'DM Mono', monospace; font-size: 0.88rem; font-weight: 300; color: var(--text);
}
.booking-value.accent { color: var(--accent); font-weight: 400; letter-spacing: 0.05em; }

/* ── WHATSAPP NOTICE ───────────────────────────────────────────────────────── */
.whatsapp-notice {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.78rem; color: #25d366; font-weight: 500;
  background: rgba(37, 211, 102, 0.08); border: 1px solid rgba(37, 211, 102, 0.25);
  border-radius: 8px; padding: 10px 16px; margin: 16px 0 8px;
}

/* ── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .interview-body { grid-template-columns: 1fr; }
  .transcript-panel { border-left: none; border-top: 1px solid var(--border); max-height: 220px; }
  .booking-label { min-width: 100px; }
  .header-left .user-badge { display: none; }
}
