/* ============================================================
   FEATURE CSS: AI COACH
   ============================================================ */

.coach-orb {
  position: fixed;
  right: calc(50% - (var(--app-w) / 2) + var(--s-5));
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 28px);
  z-index: var(--z-orb);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 30%,
    color-mix(in srgb, var(--support) 55%, #fff) 0%,
    var(--support) 52%,
    var(--accent) 130%);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--support) 42%, transparent);
  animation: orbFloat 3.6s ease-in-out infinite;
}
.coach-orb svg {
  width: 24px;
  height: 24px;
  color: var(--on-accent);
}
@keyframes orbFloat {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--support) 42%, transparent);
  }
  50% {
    transform: translateY(calc(var(--float-amp) * -1));
    box-shadow: 0 10px 26px color-mix(in srgb, var(--support) 62%, transparent);
  }
}

@media (max-width: 520px) {
  .coach-orb { right: var(--s-5); }
}

/* ── Messages ─────────────────────────────────────────────── */
.chat-msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: var(--s-4);
}

.bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: var(--r-lg);
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre-wrap;
  animation: bubbleIn var(--dur) var(--ease) both;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bubble--bot {
  align-self: flex-start;
  background: var(--surface-2);
  border: var(--border-w) solid var(--rim);
  border-bottom-left-radius: var(--r-xs);
}
.bubble--me {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--support), var(--accent));
  color: var(--on-accent);
  font-weight: var(--body-weight-strong);
  border-bottom-right-radius: var(--r-xs);
}
.bubble--error {
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-2));
}

/* three dots that breathe, rather than the word "thinking" */
.bubble--thinking {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 15px;
}
.bubble--thinking span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dimmer);
  animation: dot 1.2s ease-in-out infinite;
}
.bubble--thinking span:nth-child(2) { animation-delay: 0.16s; }
.bubble--thinking span:nth-child(3) { animation-delay: 0.32s; }
@keyframes dot {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ── Age gate ─────────────────────────────────────────────
   Wider than a normal bubble: it's a decision, not a remark. */
.bubble--gate {
  max-width: 100%;
  border-color: var(--rim-strong);
}
.gate-title {
  font-size: 0.78rem;
  font-weight: var(--body-weight-strong);
  color: var(--text);
  margin-bottom: 4px;
}
.gate-body {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-dimmer);
}
.gate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.gate-yes {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}
.gate-yes:hover { color: var(--on-accent); opacity: 0.92; }

/* ── Starters ─────────────────────────────────────────────── */
.chat-starters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-1);
}
.chat-starter {
  padding: 7px 12px;
  border-radius: var(--r-pill);
  border: var(--border-w) solid var(--rim-strong);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 0.76rem;
  font-weight: var(--body-weight-strong);
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.chat-starter:hover { color: var(--text); border-color: var(--accent); }

/* ── Composer ─────────────────────────────────────────────── */
.chat-composer {
  display: flex;
  gap: var(--s-2);
  flex-shrink: 0;
  padding: var(--s-3);
  padding-bottom: calc(var(--s-3) + env(safe-area-inset-bottom, 0px));
  border-top: var(--border-w) solid var(--rim);
}
.chat-input {
  flex: 1;
  min-width: 0;
  padding: 11px var(--s-4);
  border-radius: var(--r-md);
  border: var(--border-w) solid var(--rim);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.86rem;
}
.chat-input::placeholder { color: var(--text-dimmer); }
.chat-input:focus { outline: 2px solid var(--support); outline-offset: 1px; }
.chat-input:disabled { opacity: 0.55; }

.chat-send {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--support), var(--accent));
}
.chat-send svg { width: 17px; height: 17px; color: var(--on-accent); }

@media (prefers-reduced-motion: reduce) {
  .coach-orb, .bubble, .bubble--thinking span { animation: none; }
}
