/* Hope Intake Demo — chat room styles.
   Banner styling per WA_PLAYGROUND_DOCTRINE.md §2.1 — high-contrast,
   sticky, impossible to miss. */

:root {
  --bg: #1a1d22;
  --bg-elev: #23272d;
  --bg-elev-2: #2c3038;
  --fg: #e6e8eb;
  --fg-muted: #9aa3ad;
  --border: #3a3f47;
  --user-bubble: #2d4f7a;
  --assistant-bubble: #2a3038;
  --accent: #6ec1ff;
  --warn: #f5c542;
  --warn-bg: #4a3a08;
  --danger: #ff5d5d;
  --success: #71d489;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", "Menlo", monospace;
  --sans: -apple-system, "Segoe UI", system-ui, "Roboto", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   Playground banner — per WA_PLAYGROUND_DOCTRINE.md §2.1.
   High-contrast warning style, sticky at top, never scrolls away. */
#banner {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffb300;
  color: #1a1100;
  padding: 10px 16px;
  text-align: center;
  font-weight: 700;
  border-bottom: 3px solid #cc7a00;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}
#banner .banner-line-1 {
  font-size: 15px;
  letter-spacing: 0.04em;
}
#banner .banner-line-2 {
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
  opacity: 0.85;
}

/* ============================================================
   Toolbar */
#toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  gap: 12px;
  flex-wrap: wrap;
}
#toolbar .title { font-size: 16px; }
#toolbar .muted { color: var(--fg-muted); font-size: 12px; margin-left: 8px; }
#toolbar .toolbar-right { display: flex; gap: 8px; align-items: center; }

button, select, input, textarea {
  font-family: inherit;
  font-size: 14px;
}

button {
  background: var(--bg-elev-2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 80ms;
}
button:hover { background: #353b45; }
button:active { background: #20242a; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

select, input[type="text"], textarea {
  background: var(--bg-elev-2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
}

/* ============================================================
   Hard fail + error banners */
#hard-fail {
  background: var(--danger);
  color: #1a0000;
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 2px solid #aa2020;
}
#error-banner {
  background: var(--warn-bg);
  color: var(--warn);
  padding: 8px 16px;
  border-bottom: 1px solid #6a5210;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
#error-banner button {
  background: transparent;
  border: none;
  color: var(--warn);
  font-size: 18px;
  padding: 0 6px;
  cursor: pointer;
}

/* ============================================================
   Layout: chat pane (left) + metadata pane (right) */
#layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
  flex: 1;
  min-height: 0;
}

#chat-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-height: 0;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 10px;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.bubble.user {
  align-self: flex-end;
  background: var(--user-bubble);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}
.bubble.assistant {
  align-self: flex-start;
  background: var(--assistant-bubble);
  color: var(--fg);
  border-bottom-left-radius: 2px;
  border: 1px solid var(--border);
}
.bubble.assistant.sanitizer-fired {
  border-color: var(--warn);
  box-shadow: 0 0 0 1px var(--warn);
}
.bubble.assistant.blocked {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}
.bubble .meta-row {
  margin-top: 6px;
  font-size: 11px;
  color: var(--fg-muted);
  font-family: var(--mono);
}
.bubble.assistant .badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  margin-right: 6px;
}
.badge.sanitizer { background: var(--warn-bg); color: var(--warn); }
.badge.blocked { background: #4a1010; color: var(--danger); }

#input-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}
#input-box {
  flex: 1;
  resize: vertical;
  min-height: 38px;
  max-height: 200px;
}
#btn-send {
  align-self: flex-end;
  background: var(--accent);
  color: #001a2e;
  font-weight: 700;
  border-color: var(--accent);
}
#btn-send:hover { background: #92d3ff; }

#notes-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
#notes-row label {
  color: var(--fg-muted);
  font-size: 12px;
  white-space: nowrap;
}
#notes-row input { flex: 1; }

/* ============================================================
   Metadata sidebar */
#meta-pane {
  background: var(--bg-elev);
  padding: 16px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 12px;
}
#meta-pane h2 {
  font-family: var(--sans);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin: 16px 0 8px;
}
#meta-pane h2:first-of-type { margin-top: 0; }
.meta-block {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 0;
}
.meta-block dt {
  color: var(--fg-muted);
  font-weight: 600;
}
.meta-block dd {
  margin: 0;
  word-break: break-all;
}
.meta-block dd.true { color: var(--warn); font-weight: 700; }
.meta-block dd.false { color: var(--success); }

/* ============================================================
   WA-04 var-capture panel (Phase 1.5.D-4) per
   WA_PKT_PLAYGROUND_WA04_CAPTURE_INDICATOR_01. Lives at the top of
   #meta-pane; reuses the meta-pane's mono font + colors. */
#wa04-panel {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
#wa04-panel .wa04-caption {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--fg-muted);
  margin: 4px 0 8px;
}
#wa04-panel .wa04-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
#wa04-panel .wa04-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-muted);
}
#wa04-panel .wa04-list li.captured {
  color: var(--success);
}
#wa04-panel .wa04-mark {
  display: inline-block;
  width: 14px;
  text-align: center;
  font-weight: 700;
}
#wa04-panel .wa04-list li.captured .wa04-mark {
  color: var(--success);
}
#wa04-panel .wa04-list li:not(.captured) .wa04-mark {
  color: var(--fg-muted);
  opacity: 0.6;
}

/* ============================================================
   Mobile: single column */
@media (max-width: 768px) {
  #layout {
    grid-template-columns: 1fr;
  }
  #chat-pane { border-right: none; border-bottom: 1px solid var(--border); }
  #meta-pane { max-height: 280px; }
  .bubble { max-width: 92%; }
  /* Collapse WA-04 panel to a <details>-equivalent compact form on
     mobile so it doesn't dominate the meta-pane vertical budget. */
  #wa04-panel .wa04-list {
    grid-template-columns: 1fr 1fr;
  }
}
