/* Composer: pill input + morphing mic/send, recording bar, preview bar. */

#composer {
  border-top: var(--hairline-w) solid var(--hairline);
  flex-shrink: 0;
  padding: 9px 12px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

.composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 9px;
}

@media (min-width: 900px) {
  #composer {
    padding-left: 24px;
    padding-right: 24px;
  }
  .composer-inner {
    max-width: var(--thread-max);
    margin: 0 auto;
  }
}

/* Plus slot — disabled in v1 */
.composer-plus {
  width: 34px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  opacity: 0.5;
  flex-shrink: 0;
}
.composer-plus .icon {
  font-size: 22px;
}

.composer-pill {
  flex: 1;
  min-width: 0;
  border: var(--hairline-w) solid var(--hairline);
  background: var(--surface);
  border-radius: 18px;
  display: flex;
  align-items: center;
  min-height: 36px;
}

#composer-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  resize: none;
  padding: 8px 14px;
  font-size: 15px;
  line-height: 1.35;
  color: var(--text-1);
  max-height: 108px; /* ~5 lines */
  overflow-y: auto;
}
#composer-input::placeholder {
  color: var(--text-3);
}
#composer-input:focus-visible {
  outline: none;
}
.composer-pill:focus-within {
  border-color: var(--text-3);
}

/* Morphing send / mic button (28px visual inside a 44px-tall hit area) */
.composer-action {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
}
.composer-action .btn-disc {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.composer-action .icon {
  font-size: 17px;
}
/* mic mode (empty input) */
.composer-action.mode-mic .btn-disc {
  background: transparent;
  color: var(--accent);
}
.composer-action.mode-mic .icon {
  font-size: 20px;
}
/* send mode (has text) */
.composer-action.mode-send .btn-disc {
  background: var(--accent);
  color: var(--on-accent);
}
.composer-action:disabled .btn-disc {
  background: transparent;
  color: var(--text-3);
}

/* ── Recording bar (replaces the pill) ───────────────────────────────── */

.recording-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: var(--hairline-w) solid var(--hairline);
  border-radius: 18px;
  min-height: 36px;
  padding: 0 4px 0 4px;
}

.rec-cancel,
.rec-send {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rec-cancel {
  color: var(--text-2);
}
.rec-cancel .icon {
  font-size: 19px;
}

.rec-live {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: rec-pulse 1.1s ease-in-out infinite;
}
@keyframes rec-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rec-dot {
    animation: none;
  }
}

.rec-elapsed {
  font-size: 13px;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 34px;
}
.recording-bar.warn .rec-elapsed,
.recording-bar.warn .rec-dot {
  color: var(--danger);
  background: none;
}
.recording-bar.warn .rec-dot {
  background: var(--danger);
}

.rec-levels {
  flex: 1;
  min-width: 0;
  height: 22px;
  display: block;
}

/* Stop button: accent disc with a square */
.rec-stop {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rec-stop .btn-disc {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.rec-stop .stop-square {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--on-accent);
}

/* ── Preview bar (after stop) ────────────────────────────────────────── */

.preview-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.preview-bar .preview-note {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bubble-in);
  border-radius: 18px;
  padding: 5px 14px 5px 8px;
  min-height: 36px;
}
.preview-bar .an-play {
  color: var(--accent);
  margin: 0;
}
.preview-bar .an-time {
  color: var(--text-2);
}
.preview-bar .rec-send .btn-disc {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-bar .rec-send .icon {
  font-size: 17px;
}
