/*
  PORQUE EXISTE: botão de microfone estilo “AI Voice Sphere” — anéis
  neon azul/violeta que respiram; ao gravar pulsam como a referência.
*/
.mic-sphere-btn {
  position: relative;
  width: 52px;
  height: 52px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  color: #c8e8ff;
  overflow: visible;
  flex-shrink: 0;
}

.ai-sphere {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, rgba(40, 20, 80, 0.35) 0%, transparent 55%),
    radial-gradient(circle at 50% 50%, transparent 42%, rgba(88, 60, 255, 0.25) 58%, transparent 72%);
  box-shadow:
    0 0 18px 4px rgba(100, 60, 255, 0.35),
    0 0 36px 8px rgba(0, 180, 255, 0.2),
    inset 0 0 16px 4px rgba(120, 80, 255, 0.35);
  animation: sphere-breathe 4s ease-in-out infinite;
}

.ai-sphere-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: rgba(120, 90, 255, 0.7);
  border-right-color: rgba(0, 200, 255, 0.45);
  border-bottom-color: rgba(180, 60, 255, 0.35);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(100, 80, 255, 0.35);
}

.ai-sphere-ring.r1 {
  width: 118%;
  height: 118%;
  animation: sphere-orbit 9s linear infinite;
}
.ai-sphere-ring.r2 {
  width: 92%;
  height: 92%;
  border-top-color: rgba(0, 210, 255, 0.65);
  animation: sphere-orbit 6.5s linear infinite reverse;
}
.ai-sphere-ring.r3 {
  width: 68%;
  height: 68%;
  border-top-color: rgba(200, 80, 255, 0.55);
  opacity: 0.85;
  animation: sphere-orbit 5s linear infinite;
}

.mic-sphere-btn .mic-sphere-icon {
  position: relative;
  z-index: 2;
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 0 6px rgba(160, 140, 255, 0.7));
}

.mic-sphere-btn:hover .ai-sphere {
  box-shadow:
    0 0 24px 6px rgba(100, 60, 255, 0.5),
    0 0 48px 10px rgba(0, 200, 255, 0.28),
    inset 0 0 20px 6px rgba(120, 80, 255, 0.45);
}

/* Gravando = listening */
.mic-sphere-btn.gravando .ai-sphere {
  animation: sphere-listen 0.55s ease-in-out infinite alternate;
  box-shadow:
    0 0 28px 10px rgba(0, 212, 255, 0.55),
    0 0 56px 16px rgba(255, 43, 150, 0.28),
    inset 0 0 24px 8px rgba(0, 212, 255, 0.45);
}
.mic-sphere-btn.gravando .ai-sphere-ring.r1 {
  width: 132%;
  height: 132%;
  border-top-color: rgba(255, 60, 160, 0.7);
  animation-duration: 2.8s;
}
.mic-sphere-btn.gravando .ai-sphere-ring.r2 {
  border-top-color: rgba(0, 230, 255, 0.85);
  animation-duration: 2.2s;
}
.mic-sphere-btn.gravando .mic-sphere-icon {
  color: #00e5ff;
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.9));
}

/* Orb flutuante grande enquanto grava (mobile/desktop) */
.mic-sphere-overlay {
  position: fixed;
  left: 50%;
  bottom: calc(120px + env(safe-area-inset-bottom, 0));
  transform: translateX(-50%);
  z-index: 1150;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  pointer-events: none;
}
.mic-sphere-overlay.visivel { display: flex; }
.mic-sphere-overlay.visivel .ai-sphere {
  animation: sphere-listen 0.55s ease-in-out infinite alternate;
  box-shadow:
    0 0 40px 14px rgba(0, 212, 255, 0.5),
    0 0 80px 24px rgba(255, 43, 150, 0.25),
    inset 0 0 30px 10px rgba(100, 60, 255, 0.4);
}
.mic-sphere-overlay.visivel .ai-sphere-ring.r1 {
  width: 135%;
  height: 135%;
  border-top-color: rgba(255, 60, 160, 0.75);
  animation-duration: 3s;
}
.mic-sphere-overlay .ai-sphere {
  position: relative;
  inset: auto;
  width: 140px;
  height: 140px;
}
.mic-sphere-overlay .status-orb {
  font-family: var(--fonte-mono, monospace);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #00d4ff;
  text-shadow: 0 0 12px rgba(0, 212, 255, 0.6);
}

@keyframes sphere-breathe {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.06); opacity: 1; }
}
@keyframes sphere-listen {
  0% { transform: scale(1); }
  100% { transform: scale(1.12); }
}
@keyframes sphere-orbit {
  0% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
  50% { transform: translate(-50%, -50%) rotate(180deg) scale(1.04); }
  100% { transform: translate(-50%, -50%) rotate(360deg) scale(1); }
}

@media (max-width: 820px) {
  .mic-sphere-btn {
    width: 56px;
    height: 56px;
  }
  .mic-sphere-overlay {
    bottom: calc(140px + env(safe-area-inset-bottom, 0));
  }
  .mic-sphere-overlay .ai-sphere {
    width: 160px;
    height: 160px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-sphere,
  .ai-sphere-ring,
  .mic-sphere-btn.gravando .ai-sphere {
    animation: none !important;
  }
}
