/*
 * HubVoice — Mic-knapp och dikterings-UI
 * Följer Admin Hub-designspråket (grönt/violet/rött).
 */

/* ── Wrapper runt mic + polish-knappar ─────────────────────────────────────── */
.hub-voice-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
  margin-left: 6px;
  flex-shrink: 0;
}

/* ── Mic-knapp ──────────────────────────────────────────────────────────────── */
.hub-voice-mic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: #f9fafb;
  color: #374151;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.hub-voice-mic:hover:not(:disabled) {
  border-color: #7c3aed;
  background: #f5f3ff;
}

.hub-voice-mic:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* Inspelning aktiv — violet glow */
.hub-voice-mic--active {
  border-color: #7c3aed !important;
  background: #ede9fe !important;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
  animation: hub-voice-pulse 1.4s ease-in-out infinite;
}

@keyframes hub-voice-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25); }
  50%       { box-shadow: 0 0 0 6px rgba(124, 58, 237, 0.10); }
}

/* Felläge — rött i 5 sek */
.hub-voice-mic--error {
  border-color: #dc2626 !important;
  background: #fef2f2 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.20);
}

.hub-voice-mic-settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  border: 1.5px solid #d1d5db;
  background: #fff;
  color: #6b7280;
  font-size: 0.72rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.hub-voice-mic-settings-btn:hover {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #5b21b6;
}

.sms-compose-side .hub-voice-mic-settings-btn {
  width: 36px;
  height: 36px;
  font-size: 16px;
}

/* ── Fältet som dikteras i ─────────────────────────────────────────────────── */
.hub-voice-dictating {
  outline: 2px solid #7c3aed !important;
  outline-offset: 1px;
}

/* ── Renskriv-knapp ────────────────────────────────────────────────────────── */
.hub-voice-polish-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.8rem;
  padding: 0 0.6rem;
  border-radius: 6px;
  border: 1.5px solid #7c3aed;
  background: #f5f3ff;
  color: #5b21b6;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.hub-voice-polish-btn:hover:not(:disabled) {
  background: #7c3aed;
  color: #fff;
}

.hub-voice-polish-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* ── Status-flyover (global flytande, längst ner) ───────────────────────────── */
.hub-voice-status {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10050;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: none;
}

.hub-voice-status--idle {
  background: #1e293b;
  color: #e2e8f0;
  display: block;
}

.hub-voice-status--ok {
  background: #064e3b;
  color: #a7f3d0;
  display: block;
}

.hub-voice-status--err {
  background: #7f1d1d;
  color: #fecaca;
  display: block;
}

/* ── Mikrofonordning (inställningar) ─────────────────────────────────────────── */
.hub-voice-mic-settings__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hub-voice-mic-settings__row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--fnx-border, #e7e5e4);
  border-radius: 0.65rem;
  background: var(--fnx-bg, #fafaf9);
  cursor: grab;
  user-select: none;
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s, opacity 0.12s;
}

.hub-voice-mic-settings__row:active {
  cursor: grabbing;
}

.hub-voice-mic-settings__row--dragging {
  opacity: 0.45;
  background: #f5f3ff;
}

.hub-voice-mic-settings__row--drag-over {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
  background: #f5f3ff;
}

.hub-voice-mic-settings__handle {
  flex: 0 0 auto;
  color: #a8a29e;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: -0.08em;
  padding: 0.15rem 0.1rem;
  cursor: grab;
}

.hub-voice-mic-settings__rank {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 9999px;
  background: #ede9fe;
  color: #5b21b6;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.hub-voice-mic-settings__label {
  flex: 1 1 auto;
  font-size: 0.85rem;
  color: #44403c;
  line-height: 1.3;
  word-break: break-word;
}

.hub-voice-mic-settings__actions {
  display: inline-flex;
  gap: 0.25rem;
  flex: 0 0 auto;
}

.hub-voice-mic-settings__move,
.hub-voice-mic-settings__btn {
  border: 1px solid var(--fnx-border, #d6d3d1);
  background: #fff;
  color: #44403c;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}

.hub-voice-mic-settings__move {
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  font-size: 0.95rem;
}

.hub-voice-mic-settings__move:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.hub-voice-mic-settings__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.hub-voice-mic-settings__btn--muted {
  color: #57534e;
  background: #f5f5f4;
}

.hub-voice-mic-settings__btn--primary {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #5b21b6;
  font-weight: 600;
  margin-top: 0.5rem;
}

.hub-voice-mic-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.hub-voice-mic-settings-modal.hidden {
  display: none;
}

body.hub-voice-mic-settings-modal-open {
  overflow: hidden;
}

.hub-voice-mic-settings-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
}

.hub-voice-mic-settings-modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 32rem);
  max-height: min(85vh, 640px);
  overflow: auto;
  background: #fff;
  border-radius: 0.9rem;
  border: 1px solid var(--fnx-border, #e7e5e4);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18);
}

.hub-voice-mic-settings-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #f5f5f4;
}

.hub-voice-mic-settings-modal__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #292524;
}

.hub-voice-mic-settings-modal__close {
  border: 0;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
  color: #78716c;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}

.hub-voice-mic-settings-modal__body {
  padding: 1rem;
}
