.voice-widget {
  background: var(--color-surface-alt);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-strong);
  border: 1px solid rgba(18, 24, 38, 0.1);
  min-height: 420px;
}

.voice-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.voice-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
}

.voice-subtitle {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.voice-status {
  background: #f2f5ff;
  color: #32436b;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  max-width: 220px;
  text-align: right;
  word-break: break-word;
}

.voice-widget__body {
  position: relative;
  min-height: 320px;
}

.voice-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  gap: 1.5rem;
}

.voice-select {
  width: 100%;
  display: grid;
  gap: 0.5rem;
  text-align: left;
}

.voice-select span {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.voice-select select {
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(18, 24, 38, 0.2);
  font-family: var(--font-display);
  background: #ffffff;
}

.voice-widget[data-state="inactive"] .voice-state--inactive,
.voice-widget[data-state="connecting"] .voice-state--connecting,
.voice-widget[data-state="active"] .voice-state--active,
.voice-widget[data-state="ended"] .voice-state--ended {
  display: flex;
}

.mic-ring {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 2px solid var(--color-accent);
  display: grid;
  place-items: center;
  position: relative;
  animation: pulse 2s infinite;
}

.mic-dot {
  width: 18px;
  height: 18px;
  background: var(--color-accent);
  border-radius: 50%;
}

.pulse-loader {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid rgba(255, 107, 74, 0.3);
  border-top-color: var(--color-accent);
  animation: spin 1s linear infinite;
}

.voice-activity {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
}

.speaker {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid rgba(18, 24, 38, 0.08);
  display: grid;
  gap: 0.5rem;
  align-items: center;
}

.speaker.active {
  border-color: rgba(255, 107, 74, 0.6);
  box-shadow: 0 0 0 2px rgba(255, 107, 74, 0.2);
}

.waveform {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd2c4 0%, #ff6b4a 50%, #ffd2c4 100%);
  background-size: 200% 100%;
  animation: waveform 1.4s ease-in-out infinite;
  opacity: 0.2;
}

.speaker.active .waveform {
  opacity: 1;
}

.voice-transcript {
  width: 100%;
  height: 160px;
  overflow-y: auto;
  border: 1px solid rgba(18, 24, 38, 0.1);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: #ffffff;
  text-align: left;
  display: grid;
  gap: 0.75rem;
}

.transcript-entry {
  display: grid;
  gap: 0.25rem;
}

.transcript-entry.agent {
  color: #1a2b52;
}

.transcript-entry.user {
  color: #3b3f4b;
  text-align: right;
}

.voice-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.75rem;
}

.session-timer {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text-muted);
}

.end-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
}

.end-note {
  color: var(--color-text-muted);
}

.voice-end-actions {
  display: flex;
  gap: 1rem;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 107, 74, 0.35);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 20px rgba(255, 107, 74, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 107, 74, 0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes waveform {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@media (max-width: 980px) {
  .voice-widget {
    padding: 1.5rem;
  }

  .voice-activity {
    grid-template-columns: 1fr;
  }

  .voice-end-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 700px) {
  .voice-widget {
    min-height: 70vh;
  }
}
