/* WellHeart London — text chat page. Reuses tokens/buttons/fonts from app.css;
   petite, rectangular, medical — not big consumer bubbles. RTL-aware via
   logical properties. */

.chat-wrap { max-width: 780px; margin: 0 auto; padding: 120px var(--gutter) var(--section); }
.chat-back {
  display: inline-block; margin-bottom: 28px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--secondary); text-decoration: none;
}
.chat-back:hover { color: var(--primary); text-decoration: underline; }
.chat-head { text-align: center; margin-bottom: 28px; }
.chat-head .brand-logo { height: 50px; width: auto; display: inline-block; margin-bottom: 22px; }
.chat-head .lede { max-width: 54ch; margin: 12px auto 0; font-size: 16px; }

/* Conversation panel */
.chat-panel {
  border: 1px solid var(--hairline); background: var(--white);
  border-radius: var(--radius); overflow: hidden;
}
/* The log grows with the conversation (no inner scroll box) so every reply is
   fully visible; the page scrolls and the input below stays reachable (sticky). */
.chat-log {
  min-height: 220px;
  padding: 24px; display: flex; flex-direction: column; gap: 14px;
  background: var(--background);
}
.msg { max-width: 84%; display: flex; flex-direction: column; gap: 4px; scroll-margin-top: 84px; scroll-margin-bottom: 96px; }
.msg .who {
  font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
}
.msg .txt {
  font-size: 15px; line-height: 1.55; white-space: pre-wrap;
  padding: 11px 15px; border-radius: 3px;
}
.from-assistant { margin-inline-end: auto; align-items: flex-start; }
.from-assistant .who { color: var(--secondary); }
.from-assistant .txt { background: var(--surface-stone); border: 1px solid var(--hairline); color: var(--on-background); }
.from-you { margin-inline-start: auto; align-items: flex-end; }
.from-you .who { color: var(--on-surface-variant); }
.from-you .txt { background: var(--primary); color: var(--on-primary); }

/* Input row — sticks to the bottom of the viewport while chatting so it's
   always reachable as the log grows above it. */
.chat-input {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 10px; padding: 14px;
  border-top: 1px solid var(--hairline); background: var(--white);
  box-shadow: 0 -6px 16px rgba(10, 31, 68, .05);
}
.chat-input textarea {
  flex: 1; font: inherit; font-size: 15px; line-height: 1.5; color: var(--on-background);
  background: var(--white); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 11px 14px; resize: none; max-height: 140px; min-height: 44px;
}
.chat-input textarea:focus { outline: none; border-color: var(--primary); }
.chat-send { flex-shrink: 0; align-self: stretch; padding: 12px 22px; }
.chat-send[disabled] { opacity: .55; cursor: default; }
.chat-unavail { padding: 24px; text-align: center; font-size: 14px; color: var(--on-surface-variant); }

/* A gentle, low-key safety note — reassurance, not an alarm banner. */
.chat-emergency {
  display: flex; gap: 10px; align-items: baseline;
  margin: 16px 2px 0; font-size: 12.5px; line-height: 1.55;
  color: var(--on-surface-variant);
  border-inline-start: 2px solid rgba(119, 90, 25, .35); padding-inline-start: 12px;
}
.chat-emergency span[aria-hidden] { color: var(--secondary); }

/* Leave-your-details card */
.chat-lead { margin-top: 36px; border: 1px solid var(--hairline); background: var(--surface-stone); border-radius: var(--radius); padding: 30px; }
.chat-lead h2 { font-family: var(--serif); font-weight: 600; font-size: 21px; color: var(--primary); margin: 0 0 6px; }
.chat-lead .sub { font-size: 14px; color: var(--on-surface-variant); margin: 0 0 22px; }

/* Form controls (mirrors voice.css so this page needs only app.css + chat.css) */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--primary); margin-bottom: 6px; }
.field input {
  width: 100%; font: inherit; font-size: 16px; color: var(--on-background);
  background: var(--white); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 12px 14px;
}
.field input:focus { outline: none; border-color: var(--primary); }
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 20px 0; font-size: 14px; line-height: 1.5; color: var(--on-surface-variant); }
.consent input { margin-top: 3px; flex-shrink: 0; }
.consent a { color: var(--secondary); text-decoration: underline; }
.chat-lead .btn { width: 100%; }
.form-msg { margin-top: 14px; font-size: 14px; }
.form-msg.ok { color: #1f6b3a; }
.form-msg.err { color: #8a1b1b; }

/* Arabic: the chat is RTL and uses the bundled Naskh/Amiri like the rest of the site. */
[dir="rtl"] .chat-input textarea,
[dir="rtl"] .field input,
[dir="rtl"] .msg .txt { text-align: right; }
[dir="rtl"] .field label, [dir="rtl"] .msg .who { letter-spacing: normal; text-transform: none; }

@media (max-width: 767px) {
  .chat-wrap { padding-top: 90px; }
  .chat-log { max-height: 52vh; }
  .msg { max-width: 92%; }
}
