/* chat.css — additive styles for the conversational interface and the two-pane
   layout. Loaded AFTER styles.css; reuses its tokens/components where possible
   (.panel, .mode-pill, .primary/.secondary, .disclaimer-banner, .site-footer). */

/* ---- two-pane layout ---- */
.chat-layout {
  max-width: 1240px;
  margin: 1rem auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 900px) {
  .chat-layout {
    grid-template-columns: 1fr;
  }
}

/* ---- chat column ---- */
.chat-col {
  display: flex;
  flex-direction: column;
  min-height: 60vh;
  background: var(--panel-bg, #fff);
  border: 1px solid var(--border, #d9dee6);
  border-radius: 12px;
  padding: 0.75rem;
  position: sticky;
  top: 0.5rem;
}

@media (max-width: 900px) {
  .chat-col {
    position: static;
    min-height: 50vh;
  }
}

.chat-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.25rem 0.5rem;
  border-bottom: 1px solid var(--border, #e6e9ef);
}
.chat-toolbar .spacer { flex: 1; }
.quickfill-link {
  font-size: 0.85rem;
  color: var(--accent, #1f6feb);
  text-decoration: none;
  white-space: nowrap;
}
.quickfill-link:hover { text-decoration: underline; }

.transcript {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 240px;
}

/* ---- message bubbles ---- */
.msg { max-width: 88%; display: flex; flex-direction: column; gap: 0.15rem; }
.msg .who {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #6b7280);
  padding: 0 0.2rem;
}
.msg .body {
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.45;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  font-size: 0.95rem;
}
.msg.bot { align-self: flex-start; }
.msg.bot .body {
  background: var(--bot-bg, #f1f4f9);
  color: var(--text, #1a2230);
  border: 1px solid var(--border, #e2e7ef);
  border-bottom-left-radius: 4px;
}
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.user .body {
  background: var(--accent, #1f6feb);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.typing .body {
  color: var(--muted, #6b7280);
  font-style: italic;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

/* ---- input row ---- */
.chat-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border, #e6e9ef);
}
.chat-form textarea {
  flex: 1;
  resize: vertical;
  min-height: 2.6rem;
  max-height: 9rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border, #cbd2dc);
  border-radius: 10px;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
}
.chat-form textarea:focus {
  outline: 2px solid var(--accent, #1f6feb);
  outline-offset: 1px;
}
.chat-form .primary { white-space: nowrap; }
.chat-form .primary:disabled { opacity: 0.55; cursor: progress; }

.chat-error {
  margin: 0.5rem 0.25rem 0;
  padding: 0.5rem 0.7rem;
  background: #fdecec;
  border: 1px solid #f3b6b6;
  color: #8a1c1c;
  border-radius: 8px;
  font-size: 0.9rem;
}

/* ---- assessment column ---- */
.assess-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.assess-empty {
  border: 1px dashed var(--border, #cbd2dc);
  border-radius: 12px;
  padding: 1.25rem;
  color: var(--muted, #5b6472);
  background: var(--panel-bg, #fff);
}
.assess-empty h2 { margin-top: 0; }
.assess-empty p { margin-bottom: 0; line-height: 1.5; }

#assessment-root { display: flex; flex-direction: column; gap: 1rem; }
#assessment-root .panel { margin: 0; }

/* ---- form page: small helpers ---- */
.back-to-chat {
  max-width: 980px;
  margin: 0.5rem auto 0;
  padding: 0 1rem;
  font-size: 0.92rem;
}
.back-to-chat a { color: var(--accent, #1f6feb); text-decoration: none; }
.back-to-chat a:hover { text-decoration: underline; }
.chat-body { background: var(--page-bg, #f6f8fb); }

/* Keep the on-screen chrome out of the printed cleaning record. */
@media print {
  .chat-col, .assess-empty, .chat-toolbar, .site-footer, .disclaimer-banner, .back-to-chat { display: none !important; }
  .chat-layout { display: block; }
}
