/* ==========================================================================
   VEXX VOICE MODE (UI Estilo ChatGPT Voice em Tempo Real)
   ========================================================================== */

/* Botão do Modo de Voz no Composer */
.composer-voice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-right: 6px;
  flex-shrink: 0;
}

.composer-voice:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  transform: scale(1.05);
}

.composer-voice:active {
  transform: scale(0.95);
}

.composer-voice.active {
  background: #6366f1;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.6);
  animation: pulse-mic 1.6s infinite ease-in-out;
}

@keyframes pulse-mic {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
  70% { transform: scale(1.06); box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

/* Overlay Principal do Modo de Voz */
.voice-mode-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at center, #171926 0%, #090a0f 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: env(safe-area-inset-top, 24px) 24px env(safe-area-inset-bottom, 32px) 24px;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  color: #f8fafc;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.voice-mode-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Header do Modo de Voz */
.voice-mode-header {
  width: 100%;
  max-width: 640px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
}

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

.voice-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  border-radius: 999px;
  text-transform: uppercase;
}

.voice-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #e2e8f0;
}

.voice-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.voice-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.voice-select:hover, .voice-select:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(99, 102, 241, 0.5);
}

.voice-icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.voice-icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  transform: scale(1.05);
}

/* Área Central: Visualizador Fluido (ChatGPT Voice Orb) */
.voice-visualizer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 580px;
  flex: 1;
  position: relative;
}

.voice-orb-wrapper {
  position: relative;
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
}

/* Anéis concêntricos de pulsação */
.voice-orb-rings {
  position: absolute;
  inset: -40px;
  pointer-events: none;
}

.voice-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(99, 102, 241, 0.2);
  opacity: 0;
  transition: all 0.5s ease;
}

/* Esfera Principal / Orb */
.voice-orb {
  position: relative;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #818cf8 0%, #4f46e5 50%, #312e81 100%);
  box-shadow: 0 0 50px rgba(99, 102, 241, 0.45), inset 0 0 30px rgba(255, 255, 255, 0.3);
  transition: transform 0.12s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.2s ease, background 0.4s ease;
  cursor: pointer;
  will-change: transform, box-shadow;
}

.voice-orb-inner {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4), transparent 70%);
  filter: blur(3px);
}

.voice-orb-glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.35) 0%, transparent 70%);
  filter: blur(14px);
  pointer-events: none;
}

/* Estados da Esfera (Orb) */
/* 1. Ocioso (Idle) */
.voice-orb.idle {
  animation: orb-idle 4s infinite ease-in-out;
}

@keyframes orb-idle {
  0%, 100% { transform: scale(1); box-shadow: 0 0 40px rgba(99, 102, 241, 0.35); }
  50% { transform: scale(1.04); box-shadow: 0 0 60px rgba(99, 102, 241, 0.55); }
}

/* 2. Calibrando / Reconhecendo Voz */
.voice-orb.calibrating {
  background: radial-gradient(circle at 35% 35%, #fbbf24 0%, #d97706 60%, #78350f 100%);
  box-shadow: 0 0 55px rgba(245, 158, 11, 0.6);
  animation: orb-calibrating 1.4s infinite ease-in-out;
}

@keyframes orb-calibrating {
  0% { transform: scale(0.96); box-shadow: 0 0 30px rgba(245, 158, 11, 0.4); }
  50% { transform: scale(1.08); box-shadow: 0 0 70px rgba(245, 158, 11, 0.8); }
  100% { transform: scale(0.96); box-shadow: 0 0 30px rgba(245, 158, 11, 0.4); }
}

/* 3. Ouvindo (Listening) - ondas ativas reativas ao mic */
.voice-orb.listening {
  background: radial-gradient(circle at 35% 35%, #38bdf8 0%, #0284c7 60%, #0c4a6e 100%);
  box-shadow: 0 0 65px rgba(14, 165, 233, 0.6);
}

.voice-orb.listening + .voice-orb-rings .ring-1 {
  opacity: 0.6;
  animation: ring-pulse 2s infinite linear;
}
.voice-orb.listening + .voice-orb-rings .ring-2 {
  opacity: 0.4;
  animation: ring-pulse 2s infinite linear 0.6s;
}
.voice-orb.listening + .voice-orb-rings .ring-3 {
  opacity: 0.2;
  animation: ring-pulse 2s infinite linear 1.2s;
}

@keyframes ring-pulse {
  0% { transform: scale(0.85); opacity: 0.8; }
  100% { transform: scale(1.55); opacity: 0; }
}

/* 4. Pensando (Thinking) - rotação suave de gradientes */
.voice-orb.thinking {
  background: radial-gradient(circle at 35% 35%, #c084fc 0%, #7c3aed 50%, #4c1d95 100%);
  box-shadow: 0 0 60px rgba(168, 85, 247, 0.6);
  animation: orb-spin 2.2s infinite linear;
}

@keyframes orb-spin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.05); }
  100% { transform: rotate(360deg) scale(1); }
}

/* 5. Falando (Speaking) - pulsação de voz sintetizada */
.voice-orb.speaking {
  background: radial-gradient(circle at 35% 35%, #34d399 0%, #059669 50%, #064e3b 100%);
  box-shadow: 0 0 75px rgba(16, 185, 129, 0.7);
  animation: orb-speaking 0.9s infinite alternate ease-in-out;
}

@keyframes orb-speaking {
  0% { transform: scale(0.98); box-shadow: 0 0 45px rgba(16, 185, 129, 0.5); }
  100% { transform: scale(1.14); box-shadow: 0 0 85px rgba(16, 185, 129, 0.9); }
}

/* Status do Modo de Voz */
.voice-status-label {
  font-size: 1.05rem;
  font-weight: 500;
  color: #94a3b8;
  margin-bottom: 24px;
  text-align: center;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.voice-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  animation: dot-pulse 1.5s infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
}

/* Caixa de Legendas / Subtitles */
.voice-subtitles-box {
  width: 100%;
  min-height: 90px;
  max-height: 180px;
  overflow-y: auto;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
}

.voice-sub-user {
  font-size: 0.95rem;
  color: #38bdf8;
  font-style: italic;
  line-height: 1.4;
  word-break: break-word;
}

.voice-sub-ai {
  font-size: 1rem;
  color: #f1f5f9;
  line-height: 1.5;
  font-weight: 450;
  word-break: break-word;
}

/* Rodapé / Controles */
.voice-mode-footer {
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  padding: 16px 0;
}

.voice-action-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.voice-action-btn .icon {
  width: 28px;
  height: 28px;
}

.voice-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
}

.voice-action-btn:active {
  transform: scale(0.94);
}

.voice-action-btn.muted {
  background: rgba(239, 68, 68, 0.25);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.voice-action-btn.interrupt-btn {
  background: rgba(239, 68, 68, 0.85);
  color: #ffffff;
  display: none;
}

.voice-action-btn.interrupt-btn.visible {
  display: inline-flex;
  animation: pulse-danger 1.5s infinite;
}

@keyframes pulse-danger {
  0%, 100% { box-shadow: 0 0 15px rgba(239, 68, 68, 0.6); }
  50% { box-shadow: 0 0 30px rgba(239, 68, 68, 0.9); }
}

@media (max-width: 480px) {
  .voice-orb-wrapper {
    width: 200px;
    height: 200px;
    margin-bottom: 18px;
  }
  .voice-orb {
    width: 125px;
    height: 125px;
  }
  .voice-action-btn {
    width: 56px;
    height: 56px;
  }
  .voice-subtitles-box {
    max-height: 140px;
  }
}
