/* ==========================================================================
   VSP Voice Bot AI - Aesthetic Conversational Voice Agent Stylesheet
   ========================================================================== */

:root {
  --voice-primary: #00d679;
  --voice-primary-glow: rgba(0, 214, 121, 0.45);
  --voice-cyan: #7df9ff;
  --voice-cyan-glow: rgba(125, 249, 255, 0.45);
  --voice-crimson: #ff3366;
  --voice-crimson-glow: rgba(255, 51, 102, 0.5);
  --voice-dark-bg: #07090e;
  --voice-surface: rgba(14, 20, 28, 0.82);
  --voice-border: rgba(30, 41, 59, 0.75);
}

html, body.vsp-voice-page {
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden !important;
  background-color: var(--voice-dark-bg) !important;
  color: #f8fafc !important;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  position: relative;
}

/* Background Ambient Glows */
.voice-ambient-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.voice-glow-1 {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0, 214, 121, 0.12) 0%, rgba(0, 214, 121, 0) 70%);
  border-radius: 50%;
  filter: blur(60px);
  animation: floatAmbient 12s ease-in-out infinite alternate;
}

.voice-glow-2 {
  position: absolute;
  bottom: 10%;
  right: 25%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(125, 249, 255, 0.08) 0%, rgba(125, 249, 255, 0) 70%);
  border-radius: 50%;
  filter: blur(70px);
  animation: floatAmbient 15s ease-in-out infinite alternate-reverse;
}

@keyframes floatAmbient {
  0% { transform: translate(-50%, -50%) scale(0.9); }
  100% { transform: translate(-45%, -45%) scale(1.15); }
}

/* Main Container: strictly locks height to viewport, prevents content expansion */
.voice-app-wrap {
  position: relative;
  z-index: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 72px 20px 18px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  overflow: hidden;
}

/* Header HUD & Model Status */
.voice-hud-header {
  text-align: center;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.voice-title {
  font-size: 2.1rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, #7df9ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Interactive Status Pill */
.voice-status-pill {
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 9999px;
  padding: 6px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s ease;
}

.voice-status-pill:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.voice-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00d679;
  box-shadow: 0 0 10px #00d679;
  display: inline-block;
  transition: all 0.3s ease;
}

.voice-status-pill.state-ready {
  border-color: rgba(0, 214, 121, 0.45);
  color: #a7f3d0;
}
.voice-status-pill.state-ready .voice-status-dot {
  background: #00d679;
  box-shadow: 0 0 10px #00d679;
}

.voice-status-pill.state-listening {
  border-color: rgba(125, 249, 255, 0.65);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(125, 249, 255, 0.3);
}
.voice-status-pill.state-listening .voice-status-dot {
  background: #7df9ff;
  box-shadow: 0 0 14px #7df9ff;
  animation: pulseListenDot 0.8s infinite alternate;
}

@keyframes pulseListenDot {
  from { transform: scale(0.85); opacity: 0.6; }
  to { transform: scale(1.4); opacity: 1; }
}

.voice-status-pill.state-thinking {
  border-color: rgba(251, 191, 36, 0.65);
  color: #fef08a;
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.25);
}
.voice-status-pill.state-thinking .voice-status-dot {
  background: #fbbf24;
  box-shadow: 0 0 12px #fbbf24;
}

.voice-status-pill.state-speaking {
  border-color: rgba(0, 214, 121, 0.65);
  color: #00d679;
  box-shadow: 0 0 16px rgba(0, 214, 121, 0.3);
}
.voice-status-pill.state-speaking .voice-status-dot {
  background: #00d679;
  box-shadow: 0 0 14px #00d679;
  animation: pulseListenDot 0.9s infinite alternate;
}

/* Central Holographic Voice Orb Area */
.voice-stage-container {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-height: 260px;
}

.voice-orb-wrapper {
  position: relative;
  width: 300px;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

/* Audio Visualizer Canvas */
.voice-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 440px;
  height: 440px;
  pointer-events: none;
  z-index: 1;
}

/* Concentric Orbital Rings */
.voice-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid transparent;
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.voice-ring-1 {
  width: 250px;
  height: 250px;
  border-color: rgba(0, 214, 121, 0.2);
  animation: rotateRing 14s linear infinite;
}

.voice-ring-2 {
  width: 210px;
  height: 210px;
  border-color: rgba(125, 249, 255, 0.25);
  border-style: dashed;
  animation: rotateRingRev 18s linear infinite;
}

.voice-ring-3 {
  width: 175px;
  height: 175px;
  border-color: rgba(0, 214, 121, 0.3);
  animation: rotateRing 10s linear infinite;
}

@keyframes rotateRing {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes rotateRingRev {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

/* The Core Luminous Orb */
.voice-orb {
  position: relative;
  z-index: 2;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 35% 35%, #7df9ff 0%, #00d679 45%, #053b26 85%, #000000 100%);
  box-shadow: 0 0 35px rgba(0, 214, 121, 0.5), inset 0 0 25px rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 2.1rem;
  transition: all 0.35s ease;
  animation: orbBreathe 4s ease-in-out infinite;
  cursor: pointer;
}

.voice-orb i {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.7));
  transition: transform 0.25s ease;
}

@keyframes orbBreathe {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 35px rgba(0, 214, 121, 0.5), inset 0 0 25px rgba(255, 255, 255, 0.6);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 50px rgba(0, 214, 121, 0.75), 0 0 25px rgba(125, 249, 255, 0.5), inset 0 0 35px rgba(255, 255, 255, 0.8);
  }
}

/* State: LISTENING */
.voice-stage-container.state-listening .voice-orb {
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #00d679 50%, #064e3b 100%);
  box-shadow: 0 0 65px rgba(0, 214, 121, 0.95), 0 0 30px rgba(125, 249, 255, 0.6), inset 0 0 30px rgba(255, 255, 255, 0.9);
  animation: orbListen 1.5s ease-in-out infinite;
}

.voice-stage-container.state-listening .voice-ring-1 {
  border-color: rgba(0, 214, 121, 0.65);
  transform: scale(1.12);
}

@keyframes orbListen {
  0%, 100% { transform: scale(1.04); }
  50% { transform: scale(1.16); box-shadow: 0 0 80px rgba(0, 214, 121, 1), 0 0 40px rgba(125, 249, 255, 0.8), inset 0 0 35px #ffffff; }
}

/* State: THINKING */
.voice-stage-container.state-thinking .voice-orb {
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #7df9ff 50%, #0284c7 100%);
  box-shadow: 0 0 60px rgba(125, 249, 255, 0.85), inset 0 0 30px rgba(255, 255, 255, 0.9);
  animation: orbThink 2s linear infinite;
}

@keyframes orbThink {
  0% { transform: rotate(0deg) scale(1.02); }
  50% { transform: rotate(180deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(1.02); }
}

/* State: SPEAKING */
.voice-stage-container.state-speaking .voice-orb {
  background: radial-gradient(circle at 35% 35%, #7df9ff 0%, #00d679 40%, #0369a1 90%);
  box-shadow: 0 0 70px rgba(125, 249, 255, 0.85), 0 0 40px rgba(0, 214, 121, 0.6);
  animation: orbSpeak 1.2s ease-in-out infinite;
}

@keyframes orbSpeak {
  0%, 100% { transform: scale(1.04); }
  50% { transform: scale(1.15); box-shadow: 0 0 85px rgba(125, 249, 255, 1), 0 0 50px rgba(0, 214, 121, 0.8); }
}

/* Live Bottom Caption Dock (Fixed height, only live text, never expands page) */
.voice-live-bottom-dock {
  width: 100%;
  max-width: 680px;
  margin-top: auto;
  margin-bottom: 12px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  box-sizing: border-box;
  z-index: 5;
}

.voice-live-caption-card {
  cursor: pointer;
  user-select: none;
  width: 100%;
  height: 60px;
  min-height: 60px;
  max-height: 60px;
  background: var(--voice-surface);
  border: 1px solid var(--voice-border);
  border-radius: 16px;
  padding: 0 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  gap: 14px;
  box-sizing: border-box;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.voice-live-caption-card.active-user {
  border-color: rgba(125, 249, 255, 0.45);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(125, 249, 255, 0.18);
}

.voice-live-caption-card.active-ai {
  border-color: rgba(0, 214, 121, 0.45);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 214, 121, 0.18);
}

.voice-live-badge {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.voice-live-badge.badge-ready {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.voice-live-badge.badge-user {
  background: rgba(125, 249, 255, 0.18);
  color: var(--voice-cyan);
  border: 1px solid rgba(125, 249, 255, 0.4);
  box-shadow: 0 0 12px rgba(125, 249, 255, 0.3);
}

.voice-live-badge.badge-ai {
  background: rgba(0, 214, 121, 0.18);
  color: var(--voice-primary);
  border: 1px solid rgba(0, 214, 121, 0.4);
  box-shadow: 0 0 12px rgba(0, 214, 121, 0.3);
}

.voice-live-badge.badge-thinking {
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.voice-live-text {
  flex: 1;
  font-size: 0.96rem;
  line-height: 1.35;
  color: #f1f5f9;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.voice-live-text.text-user {
  color: #7df9ff;
  font-weight: 600;
}

.voice-live-text.text-ai {
  color: #e2e8f0;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .voice-app-wrap {
    padding: 65px 14px 15px;
  }

  .voice-title {
    font-size: 1.8rem;
  }

  .voice-status-pill {
    padding: 5px 14px;
    font-size: 0.78rem;
  }

  .voice-orb-wrapper {
    width: 240px;
    height: 240px;
  }

  .voice-canvas {
    width: 330px;
    height: 330px;
  }

  .voice-ring-1 { width: 190px; height: 190px; }
  .voice-ring-2 { width: 160px; height: 160px; }
  .voice-ring-3 { width: 135px; height: 135px; }
  .voice-orb { width: 105px; height: 105px; font-size: 1.7rem; }

  .voice-live-caption-card {
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    padding: 0 14px;
  }

  .voice-live-text {
    font-size: 0.88rem;
  }
}
