/* Voice Widget - Spindle Admin */
#voice-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ef4233;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(239, 66, 51, 0.4);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  z-index: 9999;
}
#voice-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(239, 66, 51, 0.55);
}
#voice-fab svg {
  width: 24px;
  height: 24px;
  fill: white;
}
#voice-fab.listening {
  animation: voice-pulse 1.5s ease-in-out infinite;
}
#voice-fab.hidden {
  display: none;
}

@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(239, 66, 51, 0.4); }
  50% { box-shadow: 0 4px 36px rgba(239, 66, 51, 0.7), 0 0 0 12px rgba(239, 66, 51, 0.15); }
}

/* Panel */
#voice-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 340px;
  height: 440px;
  background: #1e293b;
  border: 1px solid rgba(100, 116, 139, 0.3);
  border-radius: 16px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 9998;
  animation: voice-slide-up 0.25s ease-out;
}
#voice-panel.open {
  display: flex;
}

@keyframes voice-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
.voice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #0f172a;
  border-bottom: 1px solid rgba(100, 116, 139, 0.2);
}
.voice-header-title {
  color: #f1f5f9;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.voice-header-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  transition: background 0.3s;
}
.voice-header-title .dot.active {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}
.voice-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.voice-close:hover {
  color: #f1f5f9;
  background: rgba(100, 116, 139, 0.2);
}

/* Center area */
.voice-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 16px;
}

/* State: idle prompt */
.voice-prompt {
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
}

/* State: connecting spinner */
.voice-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #334155;
  border-top-color: #ef4233;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Audio visualizer */
.voice-visualizer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 48px;
}
.voice-visualizer .bar {
  width: 4px;
  border-radius: 2px;
  background: #ef4233;
  transition: height 0.1s ease;
  height: 8px;
}
.voice-visualizer.speaking .bar {
  animation: voice-bar 0.6s ease-in-out infinite;
}
.voice-visualizer.speaking .bar:nth-child(1) { animation-delay: 0s; }
.voice-visualizer.speaking .bar:nth-child(2) { animation-delay: 0.1s; }
.voice-visualizer.speaking .bar:nth-child(3) { animation-delay: 0.2s; }
.voice-visualizer.speaking .bar:nth-child(4) { animation-delay: 0.15s; }
.voice-visualizer.speaking .bar:nth-child(5) { animation-delay: 0.05s; }
.voice-visualizer.speaking .bar:nth-child(6) { animation-delay: 0.25s; }
.voice-visualizer.speaking .bar:nth-child(7) { animation-delay: 0.12s; }

@keyframes voice-bar {
  0%, 100% { height: 8px; }
  50% { height: 36px; }
}

/* State label */
.voice-state-label {
  color: #64748b;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Transcript area */
.voice-transcript {
  height: 140px;
  overflow-y: auto;
  padding: 12px 16px;
  border-top: 1px solid rgba(100, 116, 139, 0.15);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.voice-transcript::-webkit-scrollbar { width: 4px; }
.voice-transcript::-webkit-scrollbar-track { background: transparent; }
.voice-transcript::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

.voice-msg {
  font-size: 12px;
  line-height: 1.4;
  max-width: 90%;
  padding: 6px 10px;
  border-radius: 8px;
  animation: voice-msg-in 0.2s ease-out;
}
.voice-msg.user {
  align-self: flex-end;
  background: rgba(239, 66, 51, 0.15);
  color: #fca5a5;
  border-bottom-right-radius: 2px;
}
.voice-msg.assistant {
  align-self: flex-start;
  background: rgba(100, 116, 139, 0.15);
  color: #cbd5e1;
  border-bottom-left-radius: 2px;
}

@keyframes voice-msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mic toggle button in panel */
.voice-mic-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(239, 66, 51, 0.4);
  background: rgba(239, 66, 51, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.voice-mic-btn:hover {
  background: rgba(239, 66, 51, 0.2);
  border-color: #ef4233;
}
.voice-mic-btn.active {
  background: #ef4233;
  border-color: #ef4233;
}
.voice-mic-btn svg {
  width: 20px;
  height: 20px;
  fill: #ef4233;
}
.voice-mic-btn.active svg {
  fill: white;
}

/* Controls row */
.voice-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Mute button */
.voice-mute-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(100, 116, 139, 0.3);
  background: rgba(100, 116, 139, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.voice-mute-btn svg {
  width: 16px;
  height: 16px;
  fill: #94a3b8;
}
.voice-mute-btn:hover {
  background: rgba(100, 116, 139, 0.25);
  border-color: rgba(100, 116, 139, 0.5);
}
.voice-mute-btn.muted {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
}
.voice-mute-btn.muted svg {
  fill: #f59e0b;
}
.voice-mute-btn.muted:hover {
  background: rgba(245, 158, 11, 0.3);
}

/* End call button */
.voice-end-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: none;
  background: #dc2626;
  color: white;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.voice-end-btn:hover {
  background: #b91c1c;
}
