/* Voice OUTPUT — TTS play button on Ren reply bubbles + voice picker
   on the Account settings page. Visibility is gated by
   static/js/voice-output.js (only on assessment-type products). */

/* ===== Per-message play button ============================== */
.ai-message.voice-text-pending > .message-content {
  display: none;
}

.voice-text-wait {
  min-height: 1.25em;
}

.ai-message {
  position: relative;
}

.voice-play-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: #6b7280;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease,
              color 0.15s ease, border-color 0.15s ease;
}

.ai-message:hover .voice-play-btn,
.voice-play-btn:focus-visible,
.voice-play-btn[data-state="playing"],
.voice-play-btn[data-state="loading"] {
  opacity: 1;
}

.voice-play-btn:hover:not(:disabled) {
  background: #f3f4f6;
  color: #111827;
  border-color: #e5e7eb;
}

.voice-play-btn[data-state="playing"] {
  color: #111827;
  background: #f3f4f6;
  border-color: #d1d5db;
}

.voice-play-btn:disabled {
  cursor: progress;
  opacity: 0.7;
}

.voice-play-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #d1d5db;
  border-top-color: #111827;
  border-radius: 50%;
  animation: voice-play-spin 0.7s linear infinite;
}

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

/* ===== Voice picker on /account ============================== */
.voice-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.voice-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--gray-light);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.voice-picker-item:hover {
  border-color: var(--gray-mid);
}

.voice-picker-item.is-selected {
  border-color: var(--navy);
  background: var(--surface-cool-strong);
}

.voice-picker-item input[type="radio"] {
  margin: 0;
}

.voice-picker-label {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  text-transform: capitalize;
}

.voice-picker-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--gray-light);
  border-radius: 50%;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.voice-picker-preview:hover:not(:disabled) {
  background: #f3f4f6;
  color: var(--navy);
}

.voice-picker-preview:disabled {
  cursor: progress;
  opacity: 0.6;
}

.voice-picker-preview[data-state="playing"] {
  color: var(--navy);
  background: #f3f4f6;
}

.voice-picker-status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--gray-mid);
  min-height: 16px;
}

/* ===== Auto-play toggle (input-area) =========================
   Lives next to the mic. Hidden by default; voice-output.js
   removes .hidden on assessment products and toggles
   data-state="on|off" on click. The two SVG icons are siblings
   inside the button — only the one matching the current state
   is shown. Default visual = OFF (muted speaker). */
.autoplay-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease,
              border-color 0.15s ease;
  flex-shrink: 0;
}

.autoplay-toggle-btn.hidden { display: none; }

.autoplay-toggle-btn:hover {
  background: #f3f4f6;
  color: #111827;
  border-color: #e5e7eb;
}

.autoplay-toggle-btn:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

/* Default = OFF (show the muted-speaker icon, hide the on icon). */
.autoplay-toggle-btn .autoplay-icon-on  { display: none; }
.autoplay-toggle-btn .autoplay-icon-off { display: inline-flex; }

.autoplay-toggle-btn[data-state="on"] {
  color: #111827;
  background: #eef2ff;
  border-color: #c7d2fe;
}
.autoplay-toggle-btn[data-state="on"] .autoplay-icon-on  { display: inline-flex; }
.autoplay-toggle-btn[data-state="on"] .autoplay-icon-off { display: none; }
