/* ============================================
   DISEÑO PURE VOICE - style.css
   Estilo Premium de Esfera de Voz 3D (estilo Siri/Gemini Live)
============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #03060f;
  --surface: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --primary: #6c63ff;
  --secondary: #00f5d4;
  --danger: #ff4757;
  --text: #f3f4f6;
  --text-muted: rgba(243, 244, 246, 0.5);
  
  /* Estados de color de la Esfera */
  --orb-idle: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --orb-listening: linear-gradient(135deg, #10b981, #06b6d4);
  --orb-thinking: linear-gradient(135deg, #f59e0b, #ec4899);
  --orb-speaking: linear-gradient(135deg, #8b5cf6, #ec4899);
  
  --font: 'Outfit', sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* ============================================
   DEGRADADOS DE FONDO (Fondo Cósmico)
============================================ */
.bg-orbs { position: absolute; inset: 0; z-index: 0; pointer-events: none; }

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
}
.orb-1 { width: 600px; height: 600px; background: var(--primary); top: -200px; left: -150px; }
.orb-2 { width: 500px; height: 500px; background: var(--secondary); bottom: -150px; right: -100px; }

/* ============================================
   VOICE CONTAINER
============================================ */
.voice-container {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  max-height: 800px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 30px 24px;
  z-index: 1;
  position: relative;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 0 20px rgba(108, 99, 255, 0.4);
}

.logo-text { font-weight: 700; font-size: 16px; letter-spacing: 0.5px; }

.settings-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.settings-btn:hover { background: rgba(255,255,255,0.08); transform: rotate(45deg); }

/* Voice Hub */
.voice-hub {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 40px;
}

.assistant-profile { text-align: center; }
.assistant-name { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; }
.assistant-status { color: var(--text-muted); font-size: 15px; margin-top: 6px; font-weight: 400; }

/* ============================================
   ESFERA DE VOZ PULSANTE (EL ORB)
============================================ */
.orb-wrapper {
  position: relative;
  width: 180px; height: 180px;
  display: flex; align-items: center; justify-content: center;
}

.voice-orb {
  width: 140px; height: 140px;
  border-radius: 50%;
  background: var(--orb-idle);
  border: none;
  cursor: pointer;
  outline: none;
  z-index: 5;
  padding: 4px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 50px rgba(59, 130, 246, 0.4), inset 0 0 20px rgba(255,255,255,0.2);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.orb-inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: rgba(10, 15, 30, 0.85);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.4s;
}

.orb-icon { font-size: 38px; filter: drop-shadow(0 0 8px rgba(255,255,255,0.5)); transition: all 0.3s; }

/* Efecto de resplandor trasero */
.orb-glow {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: var(--orb-idle);
  filter: blur(30px);
  opacity: 0.5;
  z-index: 2;
  transition: all 0.6s ease;
  animation: floatOrb 6s ease-in-out infinite;
}

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

/* Anillos de Ondas (Para cuando el micrófono o bot habla) */
.pulse-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--primary);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
  transition: all 0.4s;
}

.voice-container.listening .pulse-ring,
.voice-container.speaking .pulse-ring {
  animation: pulseOut 2.5s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.ring-1 { inset: -20px; animation-delay: 0s; }
.ring-2 { inset: -45px; animation-delay: 0.8s; }
.ring-3 { inset: -70px; animation-delay: 1.6s; }

@keyframes pulseOut {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* ============================================
   ESTADOS DE LA ESFERA
============================================ */
/* Inactivo / Inicial */
.voice-container.idle .voice-orb { background: var(--orb-idle); box-shadow: 0 0 50px rgba(59, 130, 246, 0.3); }
.voice-container.idle .orb-glow { background: var(--orb-idle); }
.voice-container.idle .pulse-ring { border-color: rgba(99, 102, 241, 0.4); }

/* Escuchando al Usuario (Mic activo) */
.voice-container.listening .voice-orb {
  background: var(--orb-listening);
  box-shadow: 0 0 60px rgba(16, 185, 129, 0.5);
  transform: scale(1.08);
}
.voice-container.listening .orb-glow { background: var(--orb-listening); }
.voice-container.listening .pulse-ring { border-color: rgba(16, 185, 129, 0.5); }
.voice-container.listening .orb-inner { background: rgba(5, 25, 20, 0.8); }

/* Pensando (Procesando API) */
.voice-container.thinking .voice-orb {
  background: var(--orb-thinking);
  box-shadow: 0 0 60px rgba(245, 158, 11, 0.5);
  animation: thinkingRotation 1.5s linear infinite;
}
.voice-container.thinking .orb-glow { background: var(--orb-thinking); }
.voice-container.thinking .orb-inner { background: rgba(20, 15, 5, 0.85); }
@keyframes thinkingRotation {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Hablando (TTS reproduciendo) */
.voice-container.speaking .voice-orb {
  background: var(--orb-speaking);
  box-shadow: 0 0 70px rgba(236, 72, 153, 0.6);
  transform: scale(1.05);
}
.voice-container.speaking .orb-glow { background: var(--orb-speaking); }
.voice-container.speaking .pulse-ring { border-color: rgba(236, 72, 153, 0.5); }
.voice-container.speaking .orb-inner { background: rgba(20, 5, 20, 0.8); }

/* Textos informativos */
.voice-prompt {
  font-size: 15px;
  color: var(--text-muted);
  text-align: center;
  max-width: 280px;
  line-height: 1.5;
}

/* Subtítulos en tiempo real */
.subtitles-container {
  width: 100%;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px 24px;
  min-height: 75px;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(10px);
}

.subtitle-text {
  font-size: 14px;
  text-align: center;
  line-height: 1.6;
  color: var(--text);
  font-style: italic;
}

/* Controles de llamada */
.call-controls { display: flex; justify-content: center; }

.control-btn {
  background: var(--danger);
  border: none;
  color: white;
  padding: 12px 28px;
  border-radius: 999px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(255, 71, 87, 0.4);
  transition: all 0.2s;
}
.control-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(255, 71, 87, 0.55); }
.control-btn:active { transform: translateY(0); }

/* ============================================
   APPOINTMENT SLIDEUP (Notificación en vivo)
============================================ */
.appt-slideup {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #0b0e17;
  border-top: 1px solid rgba(0, 245, 212, 0.3);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  box-shadow: 0 -20px 50px rgba(0,0,0,0.8), 0 0 30px rgba(0, 245, 212, 0.05);
}

.appt-slideup.active { transform: translateY(0); }

.appt-handle {
  width: 40px; height: 5px;
  background: rgba(255,255,255,0.2);
  border-radius: 5px;
  margin: 12px auto 0;
}

.appt-content { padding: 24px 28px 34px; max-width: 480px; margin: 0 auto; }

.appt-header { text-align: center; margin-bottom: 20px; }

.appt-badge {
  display: inline-block;
  background: rgba(0, 245, 212, 0.1);
  border: 1px solid rgba(0, 245, 212, 0.3);
  color: #00f5d4;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.appt-header h3 { font-size: 18px; font-weight: 700; color: #fff; }

.appt-details {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 2;
  margin-bottom: 20px;
}
.appt-details strong { color: var(--text); }

.close-appt-btn {
  width: 100%;
  background: linear-gradient(135deg, #00f5d4, #00bbf9);
  color: #03060f;
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.close-appt-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* ============================================
   MODAL CONFIGURACIÓN
============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(15px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: #0b0f19;
  border: 1px solid rgba(108, 99, 255, 0.2);
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.8);
  overflow: hidden;
}

.modal-header { padding: 24px 24px 0; text-align: center; }
.modal-header h2 { font-size: 20px; font-weight: 700; }
.modal-header p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.modal-body label { font-size: 12px; font-weight: 600; color: var(--text-muted); }

.api-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}
.api-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,0.15); }
.api-hint { font-size: 11px; color: var(--text-muted); }
.api-hint a { color: var(--primary); text-decoration: none; }

.modal-footer { padding: 0 24px 24px; }
.save-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(108,99,255,0.3);
}

/* Responsividad general */
@media (max-width: 480px) {
  .voice-container { height: 100vh; padding: 20px 16px; }
  .assistant-name { font-size: 28px; }
  .orb-wrapper { width: 150px; height: 150px; }
  .voice-orb { width: 120px; height: 120px; }
  .orb-icon { font-size: 32px; }
}
