/* ═══════════════════════════════════════════════════
   INPUT ZONE
═══════════════════════════════════════════════════ */
.input-zone {
  flex-shrink: 0;
  padding: 0 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-primary);
  position: relative;
}

/* Top border with red gradient sweep */
.input-zone::before {
  content: '';
  display: block;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--border-subtle) 15%,
    var(--border-mid) 40%,
    var(--red-border) 50%,
    var(--border-mid) 60%,
    var(--border-subtle) 85%,
    transparent 100%
  );
  margin-bottom: 12px;
}

/* ── PROMPT CHIPS ── */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 2px;
  transition: opacity var(--t-base), max-height var(--t-slow);
  max-height: 200px;
  overflow: hidden;
}

.chips-row.is-hidden {
  opacity: 0;
  max-height: 0;
  pointer-events: none;
  margin: 0;
  padding: 0;
}

.chip {
  position: relative;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast),
              transform var(--t-spring), box-shadow var(--t-fast);
}

/* Shimmer fill on hover */
.chip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(232, 0, 13, 0.06) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  transition: transform 400ms ease;
}

.chip:hover::before {
  transform: translateX(100%);
}

.chip:hover {
  color: var(--text-primary);
  border-color: var(--red-border);
  background: var(--red-dim);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), var(--red-glow-sm);
}

.chip:active {
  transform: translateY(1px) scale(0.95);
  transition-duration: 60ms;
}

.chip__label { pointer-events: none; }

/* ── INPUT BAR ── */
.input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  padding: 10px 10px 10px 16px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), opacity 220ms ease;
  position: relative;
}

.input-bar:focus-within {
  border-color: rgba(232, 0, 13, 0.65);
  box-shadow: 0 0 0 3px rgba(232, 0, 13, 0.12),
              0 0 24px rgba(232, 0, 13, 0.14);
}

/* Scanning red line on focus */
.input-bar::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 10%;
  width: 80%;
  height: 1px;
  background: var(--red);
  transform: scaleX(0);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 1px;
}

.input-bar:focus-within::after {
  transform: scaleX(1);
}

.input-bar__field {
  flex: 1;
  min-width: 0;
}

.input-bar__textarea {
  width: 100%;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  max-height: 140px;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 2px 0;
}

.input-bar__textarea::-webkit-scrollbar { display: none; }

.input-bar__textarea::placeholder {
  color: var(--text-muted);
}

/* ── SEND BUTTON ── */
.input-bar__send {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-mid);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--t-fast);
  position: relative;
  overflow: hidden;
}

.input-bar__send::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--red);
  transform: scale(0);
  border-radius: inherit;
  transition: transform var(--t-spring);
}

.input-bar__send:not(:disabled):hover {
  color: #fff;
  border-color: var(--red);
  box-shadow: var(--red-glow-sm);
}

.input-bar__send:not(:disabled):hover::before {
  transform: scale(1);
}

.input-bar__send:not(:disabled):active::before {
  transform: scale(0.9);
}

.input-bar__send-icon {
  width: 16px;
  height: 16px;
  position: relative;
  z-index: 1;
  transition: transform var(--t-fast);
}

.input-bar__send:not(:disabled):hover .input-bar__send-icon {
  transform: translateX(2px);
}

.input-bar__send:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

/* Sending pulse — opacity only, GPU-friendly, no box-shadow repaint */
.input-bar__send.is-sending {
  animation: send-pulse 650ms ease-in-out infinite alternate;
}

@keyframes send-pulse {
  from { opacity: 0.5; }
  to   { opacity: 1;   }
}

/* ── HINT LINE ── */
.input-bar__hint {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
  opacity: 0.55;
  padding: 2px 0;
}

/* Purple Sector brand highlight inside the hint line */
.hint-brand {
  color: #C084FC;
  opacity: 1; /* overrides parent's 0.55 for the brand name */
  font-weight: 600;
}

/* ── MIC BUTTON ── */
.input-bar__mic {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-mid);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
  cursor: pointer;
}

.input-bar__mic:hover {
  color: var(--text-secondary);
  border-color: var(--border-accent);
  background: var(--bg-surface);
}

/* Listening state — red tint + gentle breathe (opacity only, GPU-composited) */
.input-bar__mic.is-listening {
  color: var(--red);
  border-color: rgba(232, 0, 13, 0.5);
  background: rgba(232, 0, 13, 0.08);
  animation: mic-breathe 1.2s ease-in-out infinite;
}

@keyframes mic-breathe {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

.input-bar__mic.is-hidden {
  display: none;
}

/* ── DISABLED WHILE STREAMING ── */
.input-bar.is-locked {
  opacity: 0.6;
  pointer-events: none;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .input-zone {
    padding: 0 12px 14px;
  }

  .chips-row {
    gap: 6px;
  }

  .chip {
    font-size: 12px;
    padding: 6px 12px;
    touch-action: manipulation; /* kill 300ms tap delay on iOS */
  }

  /* Prevent iOS from zooming in when the textarea is focused
     (iOS zooms if font-size < 16px). touch-action kills the tap delay. */
  .input-bar__textarea {
    font-size: 16px;
    touch-action: manipulation;
  }

  .input-bar__send {
    touch-action: manipulation;
  }

  .input-bar__mic {
    touch-action: manipulation;
  }
}
