/* ===== SpotClass Avatar Live — CSS ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

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

:root {
  --bg: #0a0a12;
  --surface: rgba(255,255,255,0.05);
  --border: rgba(255,255,255,0.1);
  --accent: #7c3aed;
  --accent2: #06b6d4;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --danger: #ef4444;
  --success: #10b981;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  user-select: none;
}

/* ===== CONFIG OVERLAY ===== */
.overlay {
  position: fixed; inset: 0;
  background: rgba(10,10,18,0.95);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.config-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px;
  width: 420px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 24px 80px rgba(124,58,237,0.2);
}

.config-logo {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  background: linear-gradient(135deg, #a78bfa, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.config-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.config-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.config-field input,
.config-field select {
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s;
}

.config-field input:focus,
.config-field select:focus {
  border-color: var(--accent);
}

.config-field select option { background: #1e1b4b; }

.btn-start {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-start:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-start:active { transform: translateY(0); }

.config-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ===== AVATAR SCREEN ===== */
.avatar-screen {
  position: fixed; inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-screen.hidden { display: none; }

/* Background orbs */
.av-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.25;
}
.orb.a1 {
  width: 600px; height: 600px;
  background: var(--accent);
  top: -200px; left: -200px;
  animation: orbFloat 8s ease-in-out infinite;
}
.orb.a2 {
  width: 500px; height: 500px;
  background: var(--accent2);
  bottom: -200px; right: -150px;
  animation: orbFloat 10s ease-in-out infinite reverse;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(30px,30px) scale(1.1); }
}

/* Center layout */
.av-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 1;
}

/* Avatar ring */
.av-ring {
  position: relative;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: rgba(124,58,237,0.15);
  border: 2px solid rgba(124,58,237,0.3);
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.av-ring.speaking {
  border-color: var(--accent2);
  box-shadow: 0 0 40px rgba(6,182,212,0.4), 0 0 80px rgba(6,182,212,0.15);
  animation: pulseSpeaking 0.8s ease-in-out infinite;
}

.av-ring.listening {
  border-color: var(--danger);
  box-shadow: 0 0 30px rgba(239,68,68,0.4);
  animation: pulseListening 1s ease-in-out infinite;
}

.av-ring.thinking {
  border-color: #f59e0b;
  box-shadow: 0 0 30px rgba(245,158,11,0.3);
}

@keyframes pulseSpeaking {
  0%, 100% { box-shadow: 0 0 40px rgba(6,182,212,0.4); }
  50% { box-shadow: 0 0 70px rgba(6,182,212,0.7), 0 0 120px rgba(6,182,212,0.2); }
}

@keyframes pulseListening {
  0%, 100% { box-shadow: 0 0 30px rgba(239,68,68,0.3); }
  50% { box-shadow: 0 0 50px rgba(239,68,68,0.6); }
}

#avatarCanvas {
  width: 100%; height: 100%;
  border-radius: 50%;
}

.av-name {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 8px;
}

.av-role {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: -10px;
}

/* Status */
.av-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 16px;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.3s;
}
.status-dot.idle { background: var(--muted); }
.status-dot.listening { background: var(--danger); animation: blink 1s infinite; }
.status-dot.thinking { background: #f59e0b; animation: blink 0.5s infinite; }
.status-dot.speaking { background: var(--accent2); animation: blink 0.3s infinite; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Transcript */
.av-transcript {
  max-width: 480px;
  min-height: 70px;
  text-align: center;
}

.tr-bubble {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 20px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  transition: all 0.3s;
}

.tr-bubble.ai { border-color: rgba(124,58,237,0.4); }
.tr-bubble.user { border-color: rgba(6,182,212,0.4); color: var(--accent2); }
.tr-bubble.error { border-color: rgba(239,68,68,0.4); color: var(--danger); }

/* Controls */
.av-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.ctrl-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#btnMic {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.4rem;
  box-shadow: 0 8px 32px rgba(124,58,237,0.4);
}

#btnMic.recording {
  background: linear-gradient(135deg, var(--danger), #f97316);
  box-shadow: 0 8px 32px rgba(239,68,68,0.5);
  animation: micPulse 1s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.ctrl-btn.secondary {
  width: 48px; height: 48px;
  font-size: 1.1rem;
}

.ctrl-btn:hover { opacity: 0.8; transform: scale(1.05); }
.ctrl-btn:active { transform: scale(0.97); }

.av-hint {
  font-size: 0.75rem;
  color: rgba(148,163,184,0.6);
  margin-top: -8px;
  text-align: center;
}
