/* eidolon-voice.css — Push-to-talk button + device picker + voice-msg
   markers on chat history rows.
   Scoped to #voice-ptt-btn / .voice-* / .msg-voice-* so nothing else in the
   UI shifts. The .input-wrapper position anchor stays for the device-picker
   popover. The transient transcript banner was removed when voice turns
   moved into the chat history (see eidolon-voice.js). */

.input-wrapper { position: relative; }

#voice-ptt-btn {
  background: none;
  border: 1px solid var(--border-hi);
  color: var(--muted);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: color .15s, border-color .15s, background .15s, box-shadow .15s;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#voice-ptt-btn:hover:not(:disabled)  { color: var(--amber); border-color: var(--amber-dim); }
#voice-ptt-btn:focus-visible         { outline: 2px solid var(--amber); outline-offset: 2px; }
#voice-ptt-btn:disabled              { cursor: not-allowed; opacity: .7; }

#voice-ptt-btn[data-state="recording"] {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
  animation: voice-pulse 1.1s ease-in-out infinite;
}

#voice-ptt-btn[data-state="uploading"] { color: var(--amber); border-color: var(--amber-dim); }
#voice-ptt-btn[data-state="playing"]   { color: var(--amber); border-color: var(--amber); }
#voice-ptt-btn[data-state="error"]     { color: var(--danger); border-color: var(--danger); }

@keyframes voice-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(192, 57, 43, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(192, 57, 43, 0);    }
  100% { box-shadow: 0 0 0 0   rgba(192, 57, 43, 0);    }
}

.voice-spin {
  transform-origin: 50% 50%;
  animation: voice-rotate 0.9s linear infinite;
}

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

/* ── Device-picker gear button + popover ─────────────────────────
   Gear sits next to the PTT button, mirrors its size + neutral colour.
   Popover anchors above the gear (input-wrapper is already
   position:relative, so the popover's absolute coords resolve there). */
.voice-gear-btn {
  background: none;
  border: 1px solid var(--border-hi);
  color: var(--muted);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: color .15s, border-color .15s, background .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.voice-gear-btn:hover         { color: var(--amber); border-color: var(--amber-dim); }
.voice-gear-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.voice-gear-btn[aria-expanded="true"] {
  color: var(--amber);
  border-color: var(--amber);
}

.voice-devices-popover {
  position: absolute;
  right: 12px;
  bottom: calc(100% + 6px);
  width: 280px;
  max-width: calc(100vw - 24px);
  background: var(--panel);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  padding: 10px 12px 12px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text);
}
.voice-devices-popover[hidden] { display: none; }

.voice-devices-label {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: 6px;
}
.voice-devices-label:first-child { margin-top: 0; }

.voice-devices-select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-hi);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
.voice-devices-select:focus,
.voice-devices-select:focus-visible {
  border-color: var(--amber);
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}

.voice-devices-unsupported {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  padding: 4px 0;
}

/* ── Voice-origin markers on chat history rows ────────────────────
   Voice turns reuse the standard .msg / .msg-meta layout from eidolon.css;
   these additive rules add a small mic glyph next to the role label and a
   replay button on the assistant row. Nothing here overrides the base
   message styles — `.voice-msg` is a hook for future accents. */

.msg.voice-msg .msg-avatar {
  /* Subtle amber tint so voice rows are recognisable at a glance. */
  color: var(--amber);
}

.msg-voice-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-right: 2px;
  color: var(--amber);
  flex-shrink: 0;
}

.msg-voice-replay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0;
  background: none;
  border: 1px solid var(--border-hi);
  color: var(--muted);
  border-radius: 50%;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  flex-shrink: 0;
}
.msg-voice-replay:hover         { color: var(--amber); border-color: var(--amber-dim); }
.msg-voice-replay:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
.msg-voice-replay.playing       { color: #fff; background: var(--amber); border-color: var(--amber); }
.msg-voice-replay svg           { display: block; }
