/* Vitamera-Main-Website — /diagnosis/ growth diagnosis session as a chat with Vita (ADR-023, ADR-032).
   Built from the variables and components of diagnosis.css / assessment.css (ADR-011): no new colors or fonts.
   The only new visual asset is Vita's avatar image supplied by the owner (ADR-032). */

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* Page */
.chat-main { padding-bottom: 60px; }
.chat-hero { padding: 30px 0 18px; }
.chat-hero h1 { margin-bottom: 6px; }
.chat { max-width: 860px; margin: 0 auto; }
.chat-app { display: flex; flex-direction: column; background: #fff; border: 1px solid #e7eaf1; border-radius: 26px; box-shadow: 0 20px 55px #00085012; overflow: hidden; }
.chat-templates { display: none; }

/* Header: Vita identity + progress */
.chat-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; padding: 16px 22px 14px; background: linear-gradient(120deg, #f8f4ef, #f6faff); border-bottom: 1px solid var(--border); }
.chat-avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.chat-id strong { display: block; color: var(--navy); font-size: 17px; line-height: 1.4; }
.chat-id span { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.chat-tools { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.chat-tool { border: 1px solid var(--border); background: #fff; color: var(--navy); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700; }
.chat-tool:hover { background: #eef2f6; }
.chat-progress { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.chat-stage { flex: 0 0 auto; color: var(--navy); font-size: 12px; font-weight: 700; }
.chat-progress .progress-track { flex: 1 1 auto; margin: 0; height: 6px; }

/* Conversation */
.chat-app { scroll-margin-top: 90px; }
.chat-log { display: flex; flex-direction: column; gap: 12px; padding: 20px 22px; height: clamp(300px, calc(100vh - 330px), 620px); overflow-y: auto; scroll-behavior: smooth; background: #f7f9fc; }
/* Messages keep their full height in the fixed-height log (flex items would otherwise shrink and overlap). */
.chat-log > * { flex-shrink: 0; }
.chat-note { margin: 0 auto; max-width: 620px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 13px; background: #fff; color: var(--muted); font-size: 12px; line-height: 1.8; text-align: center; }
.chat-note strong { color: var(--navy); }
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.msg-avatar { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.msg-bubble { max-width: min(78%, 620px); padding: 11px 15px; border-radius: 18px; font-size: 14px; line-height: 1.85; overflow-wrap: anywhere; white-space: pre-line; }
.msg.vita { justify-content: flex-start; }
.msg.vita .msg-bubble { background: #fff; border: 1px solid var(--border); color: var(--ink); border-end-start-radius: 6px; }
.msg.user { justify-content: flex-end; }
.msg.user .msg-bubble { background: var(--navy); color: #fff; border-end-end-radius: 6px; }
.msg.vita .msg-bubble .msg-question { display: block; margin-top: 4px; color: var(--navy); font-weight: 700; font-size: 15px; }
.msg.error .msg-bubble { background: #fff8f9; border-color: #e7a9b5; color: #a51c36; }
.msg.wide .msg-bubble { max-width: 100%; width: 100%; }
.msg-bubble:focus { outline: none; }
.typing .msg-bubble { display: inline-flex; align-items: center; gap: 5px; }
.typing-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); animation: vita-typing 1.1s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
.typing-label { margin-inline-start: 8px; color: var(--muted); font-size: 12px; }
@keyframes vita-typing { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Cards inside the conversation (consent, summary, report) */
.chat-card { width: 100%; }
.chat-card #consent-label { margin: 0; }
.chat-card #consent-label a { color: var(--navy); text-decoration: underline; }
.chat-card .security-check { margin: 12px 0 0; }
.chat-card .btn { margin-top: 6px; }
.card-title { display: block; margin: 0 0 6px; color: var(--navy); font-size: 14px; font-weight: 700; }
.card-block + .card-block { margin-top: 12px; }
.card-block ul { margin: 0; padding-inline-start: 20px; }
.done-line { color: #34722c; font-weight: 700; }

/* Quick replies and composer */
.chat-replies { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 22px 4px; border-top: 1px solid var(--border); background: #fff; }
.chat-replies:empty { display: none; }
.reply { border: 1.5px solid #d9deea; background: #fff; color: var(--navy); border-radius: 999px; padding: 9px 16px; min-height: 42px; font-size: 14px; font-weight: 700; text-align: start; line-height: 1.5; transition: .15s; }
.reply:hover { border-color: var(--blue); background: #f5fbfd; }
.reply.primary { background: var(--amber); border-color: var(--amber); }
.reply.primary:hover { background: #ef9c0a; border-color: #ef9c0a; }
.reply.selected { border-color: var(--navy); background: #f0f5db; box-shadow: inset 0 0 0 1px var(--navy); }
.reply:focus-visible, .chat-tool:focus-visible, .chat-send:focus-visible, .chat-composer textarea:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
a.reply { display: inline-flex; align-items: center; }
.wa-icon { display: inline-block; width: 16px; height: 16px; margin-inline-end: 6px; vertical-align: -3px; }
.chat-composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 22px 14px; background: #fff; }
.chat-composer textarea { flex: 1 1 auto; min-height: 46px; max-height: 160px; resize: none; border: 1.5px solid #d7deea; border-radius: 16px; padding: 11px 14px; font: inherit; font-size: 14px; line-height: 1.6; color: var(--ink); background: #fff; }
.chat-composer textarea:disabled { background: #f7f9fc; }
.chat-send { flex: 0 0 auto; border: 0; border-radius: 999px; min-height: 46px; padding: 0 20px; background: var(--navy); color: #fff; font-weight: 700; font-size: 14px; }
.chat-send:disabled { opacity: .4; }
.chat-foot { margin: 10px auto 0; max-width: 860px; color: var(--muted); font-size: 12px; text-align: center; }

/* Report */
/* Vitamera identity on the report (ADR-039): logo + slogan band, company line at the bottom. Site colors only. */
.report-brand { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; padding: 12px 18px; border-radius: 16px; background: #fff; border: 1px solid var(--border); border-bottom: 3px solid var(--amber); }
.report-logo { width: 132px; height: auto; }
.report-tagline { text-align: end; }
.report-tagline strong { display: block; color: var(--navy); font-size: 16px; line-height: 1.5; }
.report-tagline span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.report-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.share-actions { display: contents; }
.report-body { display: grid; gap: 14px; }
.report-head .eyebrow { display: block; margin-bottom: 4px; }
.report-head h2 { margin: 0 0 6px; color: var(--navy); font-size: 21px; line-height: 1.5; }
.report-head p { margin: 0; color: var(--muted); font-size: 13px; }
.report-section { border: 1px solid var(--border); border-radius: 15px; padding: 14px 16px; background: #fff; }
.report-section h3 { margin: 0 0 8px; color: var(--navy); font-size: 16px; line-height: 1.6; }
.report-section p { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.9; overflow-wrap: anywhere; white-space: normal; }
.report-section ul, .report-section ol { margin: 0; padding-inline-start: 20px; color: var(--ink); font-size: 14px; line-height: 1.9; white-space: normal; }
.report-section li { overflow-wrap: anywhere; }
.report-section .empty { color: var(--muted); font-size: 13px; }
.report-sub { margin: 10px 0 4px; color: var(--navy); font-size: 13px; font-weight: 700; }
.report-items { display: grid; gap: 10px; }
.report-item { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: #f8fafc; }
.report-item strong { display: block; color: var(--navy); font-size: 14px; margin-bottom: 4px; overflow-wrap: anywhere; }
.report-item p { font-size: 13px; }
.report-item .label { color: var(--muted); font-weight: 700; }
.report-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.report-tag { display: inline-flex; border: 1.5px solid var(--border); border-radius: 999px; padding: 3px 10px; color: var(--navy); background: #fff; font-size: 12px; font-weight: 700; }
.report-tag.high { background: var(--amber); border-color: var(--amber); }
.report-tag.check { background: #f5fbea; border-color: var(--lime); }
.report-section.lead { border-color: var(--navy); }
.report-actions { margin-top: 14px; white-space: normal; }
.session-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.quote-hint { margin: 10px 0 4px; }
.quote-done { margin: 10px 0 0; padding: 12px 14px; border-radius: 13px; background: #f5fbea; color: #34722c; font-weight: 700; font-size: 13px; line-height: 1.8; }

@media (max-width: 600px) {
  /* iPhone zooms any field under 16px on focus (the page then looks shifted): keep the composer at 16px. */
  .chat-composer textarea { font-size: 16px; }
  .report-brand { flex-direction: column; align-items: flex-start; }
  .report-tagline { text-align: start; }
  .chat-hero { padding: 20px 0 12px; }
  .chat-app { border-radius: 20px; }
  .chat-head, .chat-log, .chat-replies, .chat-composer { padding-inline: 14px; }
  .chat-head { grid-template-columns: auto 1fr; }
  .chat-tools { grid-column: 1 / -1; justify-content: flex-start; }
  .chat-log { height: clamp(260px, calc(100vh - 300px), 560px); }
  .chat-app { scroll-margin-top: 74px; }
  .msg-bubble { max-width: 86%; font-size: 14px; }
  .msg-avatar { width: 28px; height: 28px; }
  .reply { font-size: 13px; }
  .session-actions .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .typing-dot { animation: none; }
  .chat-log { scroll-behavior: auto; }
}

/* Print / Save as PDF: the report card only. */
@media print {
  @page { margin: 16mm; }
  body { background: #fff; }
  .topbar, .header, .footer, .chat-hero, .chat-head, .chat-replies, .chat-composer, .chat-foot, .chat-note, .report-actions, .vt-consent, .vt-consent-link, .vita-launcher, .vita-panel { display: none !important; }
  /* The log has a fixed screen height: print the whole report, not the visible part (ADR-039). */
  .chat-app { border: 0; box-shadow: none; overflow: visible; }
  .chat-log { display: block; height: auto !important; max-height: none !important; overflow: visible !important; background: #fff; padding: 0; }
  .report-brand, .report-section, .report-item, .report-tag { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .report-brand { break-inside: avoid; }
  .chat-log > :not(.report-msg) { display: none !important; }
  .report-msg .msg-avatar { display: none; }
  .report-msg .msg-bubble { border: 0; padding: 0; max-width: 100%; }
  .report-item { break-inside: avoid; }
  .report-section h3 { break-after: avoid; }
}
