/*
 * chat-polish.css — restrained welcome + composer polish for /user/chat
 * (templates/user/chat-v2.php). Design-system tokens only (deep teal
 * accent, neutral surfaces); no gradients, glows or emoji.
 */

/* ---- Welcome (empty state) ---- */
.empty-state-sub {
  margin: 0 0 var(--space-4);
  color: var(--chat-text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.55;
  max-width: 46ch;
}

/* The starter chips are real buttons: give them a visible keyboard focus. */
.suggestion-chip:focus-visible {
  outline: 2px solid var(--chat-accent);
  outline-offset: 2px;
  background: var(--chat-accent-dim);
  color: var(--chat-accent);
}

/* ---- Composer ---- */
/* Online/offline note: only ever reflects navigator.onLine (see
   connectivity.js) — never a guessed or fake presence state. */
.conn-chip {
  margin: var(--space-1) 0 0;
  font-size: var(--font-size-xs);
  color: var(--chat-text-secondary);
  text-align: center;
  user-select: none;
}

.conn-chip[hidden] {
  display: none;
}

/* A calm kitchen notebook, with a compact, touch-friendly composer. */
.chat-main { background: #faf9f5; }
.chat-main .empty-state { width: 100%; max-width: 670px; margin: auto; padding: 30px 8px; }
.chat-welcome-kicker { color: #0f766e; font-size: 12px; font-weight: 650; letter-spacing: .05em; margin: 0 0 12px; }
.chat-main .empty-state-lead { font-family: var(--font-display); font-size: clamp(29px, 3.3vw, 43px); font-weight: 700; line-height: 1.15; letter-spacing: -.025em; color: #203d36; margin: 0 0 16px; }
.chat-main .empty-state-sub { max-width: 53ch; line-height: 1.65; font-size: 14px; margin: 0 0 25px; }
.chat-main #suggestionGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; }
.chat-main #suggestionGrid .suggestion-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; white-space: normal; text-align: left; padding: 17px 18px; border-radius: 12px; border: 1px solid #e1e6df; background: #fff; min-height: 82px; transition: border-color .15s, background .15s; }
.chat-main #suggestionGrid .suggestion-chip strong { color: var(--ink-deep); font-size: 14px; font-weight: 600; }
.chat-main #suggestionGrid .suggestion-chip span { color: var(--text-secondary); font-size: 12px; line-height: 1.45; }
.chat-main #suggestionGrid .suggestion-chip:hover { background: var(--saffron-soft); border-color: var(--ink-deep); }
.chat-main .composer-card { border-radius: 18px; border-color: var(--line); box-shadow: 0 5px 24px rgba(11, 27, 30, .04); }
.chat-main .mode-seg-btn { min-height: 40px; padding: 8px 12px; }
.chat-main #chatInput { min-height: 62px; font-size: 15px; line-height: 1.6; }
.chat-main .msg-bubble-rich { line-height: 1.7; }
.chat-main .msg-bubble-rich .msg-heading { font-family: var(--font-display); font-weight: 700; font-size: 21px; color: var(--ink-deep); margin-top: 24px; }
.chat-main .msg-bubble-user { background: var(--bg-tertiary); color: var(--text-primary); }
.chat-main .msg-bubble-rich table { display: block; max-width: 100%; overflow-x: auto; }
.msg-retry { margin-top: 12px; display: block; padding: 9px 14px; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-deep); background: #fff; font: inherit; cursor: pointer; }
.msg-retry:focus-visible { outline: 2px solid var(--saffron); outline-offset: 3px; }
.typing-label { font-size: 12px; color: #64746b; margin-left: 8px; }
@media (max-width: 600px) {
  .chat-main .empty-state { padding: 20px 0; }
  .chat-main #suggestionGrid .suggestion-chip { padding: 13px; min-height: 90px; }
  .chat-main #suggestionGrid .suggestion-chip strong { font-size: 13px; }
  .chat-main .empty-state-sub { font-size: 13px; margin-bottom: 18px; }
  .chat-main .mode-seg-btn { flex: 1; justify-content: center; padding: 8px; }
  .chat-main .mode-seg { gap: 2px; }
  .chat-welcome-kicker { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { .chat-main #suggestionGrid .suggestion-chip { transition: none; } }

/* Keep Send visible; only the conversation scrolls, including on short phones. */
.chat-app { height: calc(100dvh - var(--nav-height)); min-height: 0; flex: 0 0 auto; }
.chat-main .chat-composer-dock { background: #faf9f5; }
.chat-main .chat-thread { flex: 0 0 auto; }
.chat-main .chat-messages:has(.empty-state:not([hidden])) { justify-content: flex-start; }
.chat-main .chat-messages:has(.empty-state:not([hidden])) .chat-thread { margin-block: auto; }
.msg-copy { display: inline-block; margin-top: 12px; padding: 8px 12px; min-height: 36px; color: #567168; background: transparent; border: 1px solid #d7e2dc; border-radius: 8px; font: inherit; font-size: 12px; cursor: pointer; }
.msg-copy:hover { background: #eff5f0; }
.msg-copy:focus-visible { outline: 2px solid #0f766e; outline-offset: 3px; }
