/* Aria booking page (demo) - same "Clinic white" look as ariaautomation.in.
   One column chat for phones first; system fonts only; light/dark follows the device. */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f7f9;
  --fg: #1e2a36;
  --muted: #4a5866;
  --rule: #e1e6ec;
  --blue: #1d5fa8;
  --blue-strong: #164b86;
  --on-blue: #ffffff;
  --stop: #a23b2a;
  --radius: 4px;
  --bubble: 10px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171d;
    --bg-alt: #182029;
    --fg: #e4e9ee;
    --muted: #a5b2bf;
    --rule: #2a3440;
    --blue: #7fb0e6;
    --blue-strong: #a3c8f0;
    --on-blue: #0d1a28;
    --stop: #f09a88;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.5 var(--font);
  overflow-wrap: break-word;
}
p, ol { margin: 0; }
p { text-wrap: pretty; }
a { color: var(--blue); text-underline-offset: 3px; }
a, button { -webkit-tap-highlight-color: transparent; }
a, button, textarea { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Whole screen: header on top, chat scrolls, message box stays at the bottom.
   The page itself never scrolls. book.js sets --vv-height / --vv-top to the VISIBLE area, because on
   iPhones the keyboard does not shrink 100dvh: Safari scrolls the page instead (blank gap, floating header). */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.app {
  position: fixed; top: var(--vv-top, 0px); left: 0; right: 0;
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; height: var(--vv-height, 100dvh);
  max-width: 40rem; margin: 0 auto;
}
@media (min-width: 42rem) {
  .app { border-inline: 1px solid var(--rule); }
}

/* ---------- Header ---------- */
.top {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.7rem 16px; padding-top: max(0.7rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--rule);
}
.mark { width: 32px; height: 32px; border-radius: 6px; flex: none; }
.who { min-width: 0; flex: 1; }
h1 { margin: 0; font-size: 1.05rem; font-weight: 600; line-height: 1.25; color: var(--blue); }
.sub { font-size: 0.85rem; color: var(--muted); line-height: 1.3; }
.demo {
  flex: none; font-size: 0.78rem; font-weight: 600; color: var(--stop);
  border: 1px solid currentColor; border-radius: var(--radius); padding: 0.1rem 0.45rem;
}

/* ---------- Chat ---------- */
.chat {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 1rem 16px; display: flex; flex-direction: column; gap: 0.9rem;
}
.notice {
  background: var(--bg-alt); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 0.6rem 0.8rem; font-size: 0.85rem; line-height: 1.45; color: var(--muted); display: grid; gap: 0.3rem;
}
.notice strong { color: var(--fg); font-weight: 600; }

.log { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.msg { max-width: 85%; min-width: 0; }
.msg p {
  padding: 0.55rem 0.8rem; border-radius: var(--bubble);
  white-space: pre-line; overflow-wrap: anywhere;
}
.msg.aria { align-self: flex-start; }
.msg.aria p { background: var(--bg-alt); border: 1px solid var(--rule); border-bottom-left-radius: var(--radius); }
.msg.you { align-self: flex-end; }
.msg.you p { background: var(--blue); color: var(--on-blue); border-bottom-right-radius: var(--radius); }
.msg.note p {
  background: transparent; border: 1px dashed var(--rule); color: var(--muted); font-size: 0.92rem;
}
/* New messages ease in (not with "reduce motion"). */
@media (prefers-reduced-motion: no-preference) {
  .msg { transition: opacity 200ms var(--ease-out), translate 200ms var(--ease-out); }
  @starting-style { .msg { opacity: 0; translate: 0 6px; } }
}

/* Typing dots */
.typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 0.75rem 0.85rem;
  background: var(--bg-alt); border: 1px solid var(--rule); border-radius: var(--bubble); border-bottom-left-radius: var(--radius); }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); opacity: 0.5; }
@media (prefers-reduced-motion: no-preference) {
  .typing span { animation: blink 1.2s infinite ease-in-out; }
  .typing span:nth-child(2) { animation-delay: 0.2s; }
  .typing span:nth-child(3) { animation-delay: 0.4s; }
  @keyframes blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }
}

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  font: 500 0.92rem/1.2 var(--font); color: var(--blue); background: var(--bg);
  border: 1px solid var(--blue); border-radius: 999px; padding: 0.55rem 0.9rem; min-height: 44px;
  cursor: pointer; transition: scale 160ms var(--ease-out);
}
.chip:active { scale: 0.97; }
.chips[hidden] { display: none; }

.status { font-size: 0.88rem; color: var(--muted); text-align: center; }
.status.problem { color: var(--stop); }

/* ---------- Message box ---------- */
.composer {
  display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 0.5rem; align-items: end;
  padding: 0.6rem 16px; padding-bottom: max(0.6rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule); background: var(--bg);
}
textarea {
  /* 16px or more so iPhones do not zoom in when the box is tapped */
  font: 400 1rem/1.4 var(--font); color: var(--fg); background: var(--bg);
  border: 1px solid var(--muted); border-radius: var(--radius);
  padding: 0.6rem 0.7rem; min-height: 46px; max-height: 8.5rem; resize: none; width: 100%; min-width: 0;
}
textarea::placeholder { color: var(--muted); opacity: 1; }
textarea:focus-visible { outline-offset: 0; }
.send {
  font: 600 1rem/1.2 var(--font); color: var(--on-blue); background: var(--blue);
  border: 0; border-radius: var(--radius); min-height: 46px; padding: 0 1.05rem; cursor: pointer;
  user-select: none; transition: scale 160ms var(--ease-out), background-color 150ms ease;
}
.send:active { scale: 0.97; }
.send:disabled { opacity: 0.55; cursor: not-allowed; scale: 1; }
@media (hover: hover) and (pointer: fine) {
  .send:not(:disabled):hover { background: var(--blue-strong); }
  .chip:hover { background: var(--bg-alt); }
}
@media (prefers-reduced-motion: reduce) {
  .send, .chip { transition: none; }
  .send:active, .chip:active { scale: 1; }
}
.count { grid-column: 1 / -1; font-size: 0.8rem; color: var(--muted); }
.count:empty { display: none; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.noscript { padding: 1rem 16px; color: var(--stop); }
