/* ── Dictation toolbar styles ─────────────────────────────────────────
   A connected toolbar strip below each textarea that holds the mic
   button and status text. Proofreading runs automatically after dictation.
   Matches the staff-portal design system (Jost font, 14px border-radius,
   soft blue palette).
   ──────────────────────────────────────────────────────────────────── */

/* Wrapper groups textarea + toolbar into one visual unit.
   The textarea's bottom corners are squared off and the toolbar's top
   corners are squared off so they appear seamlessly connected. */
.dictation-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Remove the textarea's bottom border-radius so it meets the toolbar flush */
.dictation-wrapper textarea {
  width: 100%;
  box-sizing: border-box;
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-bottom-color: transparent !important;
  margin-bottom: 0;
}

/* ── Toolbar strip ──────────────────────────────────────────────────── */
.dictation-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: #f2f6fc;
  border: 1.5px solid var(--staff-panel-border, #c9d8e8);
  border-top: 1px solid #dce6f0;
  border-radius: 0 0 14px 14px;
  min-height: 38px;
  box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s;
}

/* When the textarea is focused, highlight the toolbar border to match */
.dictation-wrapper textarea:focus ~ .dictation-toolbar {
  border-color: var(--staff-primary, #a0bcd6);
}

/* ── Mic button ─────────────────────────────────────────────────────── */
.dictation-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1.5px solid #c5cdd8;
  border-radius: 10px;
  background: #fff;
  color: #5a6775;
  font-family: 'Jost', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}

.dictation-btn svg {
  flex-shrink: 0;
}

.dictation-btn:hover:not(:disabled) {
  background: #e9eff8;
  border-color: #99a8b8;
  color: #333;
}

.dictation-btn:focus-visible {
  outline: 2px solid #5b7fff;
  outline-offset: 2px;
}

/* ── Listening state — pulsing red indicator ────────────────────────── */
.dictation-btn.dictation-listening {
  background: #fdf0f0;
  border-color: #e74c3c;
  color: #d63031;
  animation: dictation-pulse 1.4s ease-in-out infinite;
}

@keyframes dictation-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.3); }
  50%      { box-shadow: 0 0 0 5px rgba(231, 76, 60, 0); }
}

/* ── Error state ────────────────────────────────────────────────────── */
.dictation-btn.dictation-error {
  border-color: #e67e22;
  color: #d35400;
  background: #fef9f3;
}

/* ── Disabled / unsupported state ───────────────────────────────────── */
.dictation-btn.dictation-disabled,
.dictation-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f0f0f0;
}

/* ── Proofread button ──────────────────────────────────────────────── */
.dictation-btn-proofread {
  border-color: #b8c4d4;
  color: #5b3e96;
}

.dictation-btn-proofread:hover:not(:disabled) {
  background: #f0ebf8;
  border-color: #9b85b8;
  color: #4a2d7a;
}

/* ── Status text (sits to the right of the button in the toolbar) ──── */
.dictation-status {
  font-family: 'Jost', sans-serif;
  font-size: 12px;
  line-height: 1.3;
  color: #8a98a8;
  transition: color 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.dictation-status:empty {
  display: none;
}

.dictation-status-listening {
  color: #d63031;
  font-weight: 500;
}

.dictation-status-error {
  color: #d35400;
}

.dictation-status-disabled {
  color: #aaa;
  font-style: italic;
}

/* Proofreading in-progress status */
.dictation-status-proofreading {
  color: #5b3e96;
  font-weight: 500;
}

/* Success status (after proofread completes) */
.dictation-status-success {
  color: #27ae60;
  font-weight: 500;
}

/* ── Listening indicator dot (animated) ─────────────────────────────── */
.dictation-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e74c3c;
  margin-right: 2px;
  vertical-align: middle;
  animation: dictation-dot-blink 1s ease-in-out infinite;
}

@keyframes dictation-dot-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ── Responsive: on very small screens, hide the button label ──────── */
@media (max-width: 480px) {
  .dictation-btn .dictation-btn-label {
    display: none;
  }
  .dictation-btn {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    padding: 0 10px;
  }

  .dictation-toolbar {
    min-height: 44px;
  }
}
