/* Voice Popout */
.voice-popout {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-normal);
}

.voice-popout.show {
  opacity: 1;
  visibility: visible;
}

.voice-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 11, 0.8);
  backdrop-filter: blur(8px);
}

.voice-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: min(500px, 90vw);
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl), 0 0 40px rgba(139, 92, 246, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition-normal);
  margin: var(--spacing-md);
}

.voice-popout.show .voice-modal {
  transform: translate(-50%, -50%) scale(1);
}

.voice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg) var(--spacing-xl);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.voice-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.voice-content {
  flex: 1;
  padding: var(--spacing-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-lg);
  overflow-y: auto;
}

/* Luna Visualizer */
.luna-visualizer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 200px;
  height: 200px;
}

.luna-avatar-container {
  position: relative;
  z-index: 10;
}

.luna-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--accent-primary);
  object-fit: cover;
  transition: var(--transition-normal);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.avatar-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, transparent 70%);
  animation: pulse-glow 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse-glow {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0.8;
  }
}

/* Voice Waves */
.voice-waves {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.wave {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid var(--accent-primary);
  border-radius: 50%;
  opacity: 0;
  animation: wave-expand 2s ease-out infinite;
}

.wave-1 {
  width: 140px;
  height: 140px;
  animation-delay: 0s;
}

.wave-2 {
  width: 160px;
  height: 160px;
  animation-delay: 0.5s;
}

.wave-3 {
  width: 180px;
  height: 180px;
  animation-delay: 1s;
}

@keyframes wave-expand {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.4);
    opacity: 0;
  }
}

/* Voice Status */
.voice-status {
  text-align: center;
  margin-top: var(--spacing-lg);
}

.status-text {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--spacing-md);
}

.voice-indicators {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  align-items: center;
}

.indicator {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: var(--transition-normal);
}

.indicator.speaking {
  background: rgba(34, 197, 94, 0.1);
  border-color: var(--success);
  color: var(--success);
}

.indicator.processing {
  background: rgba(245, 158, 11, 0.1);
  border-color: var(--warning);
  color: var(--warning);
}

/* Voice Controls */
.voice-controls {
  display: flex;
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
}

.btn-voice-primary {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
}

.btn-voice-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-purple);
}

.btn-voice-stop {
  background: var(--error);
  color: white;
  border-color: var(--error);
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
}

.btn-voice-stop:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Voice Transcript */
.voice-transcript {
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-top: var(--spacing-lg);
}

.transcript-item {
  display: flex;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-xs);
}

.transcript-item:last-child {
  margin-bottom: 0;
}

.transcript-item.user {
  background: rgba(139, 92, 246, 0.1);
  border-left: 3px solid var(--accent-primary);
}

.transcript-item.luna {
  background: rgba(34, 197, 94, 0.1);
  border-left: 3px solid var(--success);
}

.transcript-item .speaker {
  font-weight: 600;
  font-size: 0.875rem;
  min-width: 50px;
  color: var(--text-primary);
}

.transcript-item .text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Audio Visualizer */
.audio-visualizer {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 2px;
  height: 60px;
  margin: var(--spacing-md) 0;
}

.visualizer-bar {
  width: 3px;
  background: var(--accent-primary);
  border-radius: var(--radius-sm);
  transition: height 0.1s ease;
  min-height: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .voice-modal {
    width: calc(100vw - 2rem);
    max-width: none;
    margin: 1rem;
    max-height: calc(100vh - 2rem);
  }

  .voice-content {
    padding: var(--spacing-md);
    gap: var(--spacing-md);
  }

  .luna-visualizer {
    width: 150px;
    height: 150px;
  }

  .luna-avatar {
    width: 80px;
    height: 80px;
  }

  .avatar-glow {
    width: 100px;
    height: 100px;
  }

  .voice-controls {
    flex-direction: column;
    width: 100%;
    gap: var(--spacing-sm);
  }

  .btn-voice-primary,
  .btn-voice-stop {
    width: 100%;
    min-height: 48px;
  }

  .voice-transcript {
    max-height: 150px;
    font-size: 0.8125rem;
  }

  .status-text {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .voice-modal {
    width: calc(100vw - 1rem);
    margin: 0.5rem;
    max-height: calc(100vh - 1rem);
    border-radius: var(--radius-lg);
  }

  .voice-header {
    padding: var(--spacing-md);
  }

  .voice-header h3 {
    font-size: 1.125rem;
  }

  .voice-content {
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .luna-visualizer {
    width: 120px;
    height: 120px;
  }

  .luna-avatar {
    width: 60px;
    height: 60px;
  }

  .avatar-glow {
    width: 80px;
    height: 80px;
  }

  .voice-transcript {
    max-height: 120px;
    padding: var(--spacing-sm);
  }

  .transcript-item {
    font-size: 0.75rem;
    padding: var(--spacing-xs);
  }

  .btn-voice-primary,
  .btn-voice-stop {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
    min-height: 44px;
  }

  .btn-close {
    width: 44px;
    height: 44px;
  }
}

/* Animations */
@keyframes avatar-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.6);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
  }
}

.luna-avatar.speaking {
  animation: avatar-pulse 0.5s ease-in-out infinite;
}

/* Scrollbar Styles */
.voice-transcript::-webkit-scrollbar {
  width: 4px;
}

.voice-transcript::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.voice-transcript::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: var(--radius-sm);
}
