/* SGE Voice Assistant — встроенный голосовой вид внутри модалки ai-assistant */

/* ── Panel: заполняет тело единой модалки (#sge-ai-voice-view) ── */
.sge-voice-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  color: var(--text-2, #c0dce8);
}

/* ── Сцена: волна + статус по центру ── */
.sge-voice-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 26px 24px;
}

/* Стеклянная панель с горизонтальной звуковой волной */
.sge-voice-wavebox {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 156px;
  border-radius: 16px;
  border: 1px solid rgba(190, 245, 255, 0.16);
  background:
    radial-gradient(120% 90% at 50% 50%, rgba(18, 101, 128, 0.28), transparent 70%),
    linear-gradient(165deg, rgba(12, 52, 66, 0.66), rgba(6, 30, 44, 0.72));
  box-shadow:
    inset 0 0 30px rgba(18, 101, 128, 0.25),
    0 10px 28px rgba(0, 0, 0, 0.28);
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.sge-voice-panel.is-listening .sge-voice-wavebox,
.sge-voice-panel.is-speaking .sge-voice-wavebox {
  border-color: rgba(200, 232, 228, 0.4);
  box-shadow:
    inset 0 0 38px rgba(18, 101, 128, 0.4),
    0 0 22px rgba(125, 200, 255, 0.12),
    0 10px 28px rgba(0, 0, 0, 0.28);
}

.sge-voice-panel.is-muted .sge-voice-wavebox {
  opacity: 0.62;
  filter: saturate(0.7);
}

.sge-voice-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 90%;
  height: 112px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.sge-voice-eq-bar {
  width: 4px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 3px;
  transform: scaleY(0.4);
  transform-origin: center;
  background: linear-gradient(180deg, var(--mint-soft, #c8e8e4), #126580);
  opacity: 0.55;
}

/* Волна в покое / по состоянию (когда JS-визуализатор не активен) */
.sge-voice-hero:not(.is-live) .sge-voice-eq-bar {
  animation: sge-wave-idle 1.9s ease-in-out infinite;
}

.sge-voice-panel.is-listening .sge-voice-hero:not(.is-live) .sge-voice-eq-bar {
  animation: sge-wave-active 1.1s ease-in-out infinite;
}

.sge-voice-panel.is-speaking .sge-voice-hero:not(.is-live) .sge-voice-eq-bar {
  animation: sge-wave-active 0.82s ease-in-out infinite;
}

.sge-voice-panel.is-thinking .sge-voice-hero:not(.is-live) .sge-voice-eq-bar {
  animation: sge-wave-think 1.4s ease-in-out infinite;
}

@keyframes sge-wave-idle {
  0%, 100% { transform: scaleY(0.35); opacity: 0.45; }
  50% { transform: scaleY(0.72); opacity: 0.65; }
}

@keyframes sge-wave-active {
  0%, 100% { transform: scaleY(0.3); opacity: 0.6; }
  50% { transform: scaleY(1); opacity: 0.95; }
}

@keyframes sge-wave-think {
  0%, 100% { transform: scaleY(0.28); opacity: 0.4; }
  50% { transform: scaleY(0.58); opacity: 0.7; }
}

/* ── Статус ── */
.sge-voice-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  max-width: 92%;
}

.sge-voice-status {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--mint-soft, #c8e8e4);
}

.sge-voice-status.is-err {
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--red-crit, #ff6262);
}

.sge-voice-dots {
  display: none;
  gap: 6px;
  align-items: center;
  justify-content: center;
  height: 8px;
}

.sge-voice-dots.is-on {
  display: flex;
}

.sge-voice-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3, #a6cad8);
  opacity: 0.4;
  animation: sge-dots-pulse 1.4s ease-in-out infinite;
}

.sge-voice-dots span:first-child {
  background: var(--mint-soft, #c8e8e4);
  opacity: 1;
}

.sge-voice-dots span:nth-child(2) { animation-delay: 0.18s; }
.sge-voice-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes sge-dots-pulse {
  0%, 80%, 100% { opacity: 0.35; transform: scale(0.9); }
  40% { opacity: 1; transform: scale(1); }
}

.sge-voice-mic-hint {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-3, #a6cad8);
}

.sge-voice-mic-hint[hidden] {
  display: none;
}

/* ── Нижний ряд кнопок ── */
.sge-voice-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(180, 220, 240, 0.1);
  flex-shrink: 0;
}

.sge-voice-btn {
  flex: 1;
  min-width: 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(200, 232, 228, 0.22);
  background: linear-gradient(135deg, rgba(18, 101, 128, 0.2), rgba(6, 34, 48, 0.42));
  color: var(--text-1, #f0fafb);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition: border-color 0.16s, background 0.16s, color 0.16s, transform 0.15s;
}

.sge-voice-btn__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}

.sge-voice-btn__label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sge-voice-btn:hover:not(:disabled) {
  border-color: rgba(200, 232, 228, 0.42);
  background: linear-gradient(135deg, rgba(18, 101, 128, 0.3), rgba(125, 200, 255, 0.08));
}

.sge-voice-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.sge-voice-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

/* Главная кнопка push-to-talk: «Говорить» (мятно-бирюзовый) ↔ «Стоп» (красноватый) */
.sge-voice-btn--primary:not(:disabled) {
  border-color: rgba(125, 200, 255, 0.4);
  background: rgba(18, 101, 128, 0.3);
  color: #dff2f7;
}

.sge-voice-btn--primary:not(:disabled):hover {
  border-color: rgba(200, 232, 228, 0.66);
  background: rgba(125, 200, 255, 0.24);
}

/* «Стоп» (идёт запись реплики) — красноватый акцент */
.sge-voice-ptt.is-talking:not(:disabled) {
  border-color: rgba(255, 98, 98, 0.5);
  background: linear-gradient(135deg, rgba(120, 30, 30, 0.3), rgba(6, 34, 48, 0.42));
  color: #ffd7d7;
}

.sge-voice-ptt.is-talking:not(:disabled):hover {
  border-color: rgba(255, 98, 98, 0.7);
  background: linear-gradient(135deg, rgba(120, 30, 30, 0.42), rgba(6, 34, 48, 0.42));
}

/* Переключение иконки: «Говорить» → микрофон, «Стоп» → квадрат */
.sge-voice-ptt .sge-voice-ic-stop { display: none; }
.sge-voice-ptt.is-talking .sge-voice-ic-talk { display: none; }
.sge-voice-ptt.is-talking .sge-voice-ic-stop { display: block; }

/* «Завершить» — красноватый акцент */
.sge-voice-btn--end:not(:disabled) {
  border-color: rgba(255, 98, 98, 0.34);
  background: linear-gradient(135deg, rgba(120, 30, 30, 0.22), rgba(6, 34, 48, 0.42));
  color: #ffd9d9;
}

.sge-voice-btn--end:hover:not(:disabled) {
  border-color: rgba(255, 98, 98, 0.55);
  background: linear-gradient(135deg, rgba(120, 30, 30, 0.34), rgba(6, 34, 48, 0.42));
}

/* ── Адаптив ── */
@media (max-width: 640px) {
  .sge-voice-stage {
    gap: 20px;
    padding: 18px 16px;
  }

  .sge-voice-wavebox {
    height: 128px;
  }

  .sge-voice-wave {
    height: 92px;
  }

  .sge-voice-eq-bar {
    height: 52px;
  }

  .sge-voice-status {
    font-size: 1.2rem;
  }

  .sge-voice-footer {
    padding: 12px 12px 14px;
    gap: 6px;
  }

  .sge-voice-btn {
    font-size: 0.82rem;
    padding: 0 8px;
    gap: 6px;
  }
}
