/* ================================================================
   Call Recorder modal — scoped to .cr-* classes.
   Inherits design tokens from styles.css.
   ================================================================ */

.cr-modal {
  width: min(480px, 92vw);
}

.cr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.cr-header .modal-title {
  margin: 0;
}

.cr-close {
  font-size: 1.4rem;
  line-height: 1;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}

.cr-close:hover { color: var(--text-primary); }

/* ── State wrapper ───────────────────────────────────────────── */

.cr-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
  padding: 0.5rem 0;
}

/* ── Icon ─────────────────────────────────────────────────────── */

.cr-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.cr-icon-warn {
  filter: grayscale(0);
}

/* ── Recording state ─────────────────────────────────────────── */

.cr-rec-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cr-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--danger);
  animation: cr-pulse 1.2s ease-in-out infinite;
}

@keyframes cr-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

.cr-rec-label {
  font-weight: 600;
  color: var(--danger);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.cr-timer {
  font-size: 2.75rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  line-height: 1;
}

/* ── Hint text ────────────────────────────────────────────────── */

.cr-hint {
  color: var(--text-secondary);
  max-width: 340px;
  font-size: 0.9rem;
}

/* ── Processing stages ───────────────────────────────────────── */

.cr-stages {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
  width: 100%;
  max-width: 260px;
  padding: 0.75rem 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.cr-stage {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.cr-stage span {
  width: 1.1em;
  text-align: center;
  flex-shrink: 0;
}

.cr-stage.cr-done {
  color: var(--success);
}

.cr-stage.cr-active {
  color: var(--text-primary);
  font-weight: 500;
}

/* ── Action row ───────────────────────────────────────────────── */

.cr-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Error message ───────────────────────────────────────────── */

.cr-error-msg {
  color: var(--danger);
  max-width: 340px;
  font-size: 0.9rem;
}

/* ── Toast ────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  z-index: 200;
  pointer-events: none;
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0);   }
}

/* ── Audio card in Attachments tab ──────────────────────────── */

.att-card-audio {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: visible; /* allow dropdown to escape */
  cursor: default;   /* audio cards are not clickable like file cards */
}

.att-audio-wrap {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 0;
}

/* ── Custom audio player ────────────────────────────────────── */

.cap-player {
  padding: 0.875rem 0.875rem 0.75rem;
}

.cap-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 0;
}

.cap-inner {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.cap-top-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Large play/pause button */
.cap-play-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .08s;
}
.cap-play-btn:hover  { background: #c0392b; }
.cap-play-btn:active { transform: scale(.94); }

/* Time display */
.cap-time {
  flex: 1;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Mute toggle */
.cap-mute-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color .15s;
}
.cap-mute-btn:hover { color: var(--text-primary); }

/* Full-width scrub bar */
.cap-scrub-track {
  position: relative;
  width: 100%;
  height: 6px;
  background: var(--bg-3);
  border-radius: 3px;
  cursor: pointer;
}

.cap-scrub-fill {
  position: absolute;
  inset: 0;
  right: auto;   /* width is set inline */
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  pointer-events: none;
}

.cap-scrub-thumb {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  background: #fff;
  border: 2px solid var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  transition: transform .1s;
}
.cap-scrub-thumb:active { cursor: grabbing; transform: translate(-50%, -50%) scale(1.2); }
