/* Theme variables live in shared/variables.css — loaded before this file. */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg, #0f1117);
  color: var(--text, #e2e8f0);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Page header ────────────────────────────────────── */
.page-header {
  text-align: center;
  padding: 1.25rem 1.5rem 0.65rem;
  border-bottom: 1px solid var(--border, #2d3148);
  flex-shrink: 0;
}

.page-header h1 { font-size: 1.55rem; font-weight: 700; margin-bottom: 0.25rem; }
.page-header h1 .accent { color: var(--accent-5); }
.page-header p { color: var(--muted, #8892a4); font-size: 0.85rem; max-width: 660px; margin: 0 auto; }

.back-link {
  display: inline-block;
  margin-bottom: 0.5rem;
  color: var(--muted, #8892a4);
  text-decoration: none;
  font-size: 0.8rem;
}
.back-link:hover { color: var(--accent-5); }

.ai-disclaimer {
  font-size: 0.72rem;
  color: var(--muted, #8892a4);
  margin-top: 0.3rem;
  opacity: 0.7;
}

/* ── Theme toggle ───────────────────────────────────── */
.theme-toggle {
  position: fixed;
  top: 0.75rem;
  right: 1rem;
  z-index: 100;
  background: var(--surface, #1a1d27);
  border: 1px solid var(--border, #2d3148);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text, #e2e8f0);
  line-height: 1;
}
.theme-toggle:hover { background: var(--surface-2, #22253a); }

/* ── Type tab bar ───────────────────────────────────── */
.type-tab-bar {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border, #2d3148);
  background: var(--surface, #1a1d27);
  flex-shrink: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.type-tab-bar::-webkit-scrollbar { display: none; }

.type-tab {
  flex-shrink: 0;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted, #8892a4);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.type-tab:hover { color: var(--text, #e2e8f0); }
.type-tab.active {
  color: var(--accent-5);
  border-bottom-color: var(--accent-5);
}

/* ── Main content area ──────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1rem;
}

.section-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Type badge ─────────────────────────────────────── */
.section-type-badge {
  display: inline-block;
  background: var(--accent-5);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  align-self: flex-start;
}

/* ── Setup text ─────────────────────────────────────── */
.section-setup {
  font-size: 0.9rem;
  color: var(--muted, #8892a4);
  line-height: 1.7;
}
.section-setup em { color: var(--text, #e2e8f0); font-style: italic; }
.section-setup strong { color: var(--text, #e2e8f0); font-weight: 600; }

/* ── Chat UI ────────────────────────────────────────── */
.chat-block {
  background: var(--surface, #1a1d27);
  border: 1px solid var(--border, #2d3148);
  border-radius: 10px;
  overflow: hidden;
}

.chat-row {
  padding: 0.75rem 1rem;
}

.chat-row--user {
  border-bottom: 1px solid var(--border, #2d3148);
}

.chat-row--model {
  background: var(--surface-2, #22253a);
}

.chat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted, #8892a4);
  margin-bottom: 0.4rem;
}

.chat-bubble {
  font-size: 0.875rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble--user {
  color: var(--text, #e2e8f0);
  font-style: italic;
}

.chat-bubble--model {
  color: var(--text, #e2e8f0);
  font-family: "Inter", system-ui, sans-serif;
}

/* ── Annotation marks ───────────────────────────────── */
.hallucination-mark {
  background: rgba(199, 62, 62, 0.25);
  border-bottom: 2px solid var(--accent-5);
  border-radius: 2px;
  cursor: pointer;
  padding: 0.05em 0;
  transition: background 0.15s;
}
.hallucination-mark:hover,
.hallucination-mark:focus {
  background: rgba(199, 62, 62, 0.4);
  outline: none;
}

html[data-theme="light"] .hallucination-mark {
  background: rgba(179, 48, 48, 0.15);
}
html[data-theme="light"] .hallucination-mark:hover,
html[data-theme="light"] .hallucination-mark:focus {
  background: rgba(179, 48, 48, 0.25);
}

/* ── Annotation tooltip area ────────────────────────── */
.annotation-tooltip-area {
  min-height: 2rem;
}

.inline-tooltip {
  background: var(--surface-2, #22253a);
  border: 1px solid var(--accent-5);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  font-size: 0.83rem;
  line-height: 1.55;
}
.inline-tooltip strong {
  display: block;
  color: var(--accent-5);
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.inline-tooltip p {
  color: var(--text, #e2e8f0);
}

/* ── Action row ─────────────────────────────────────── */
.action-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  padding: 0.45rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border, #2d3148);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-reveal {
  background: var(--surface-2, #22253a);
  color: var(--text, #e2e8f0);
}
.btn-reveal:hover { border-color: var(--accent-5); }
.btn-reveal--active {
  background: var(--accent-5);
  color: #fff;
  border-color: var(--accent-5);
}
.btn-reveal--active:hover { filter: brightness(0.9); }

.reveal-hint {
  font-size: 0.78rem;
  color: var(--muted, #8892a4);
}

/* ── Accordions ─────────────────────────────────────── */
.accordion {
  background: var(--surface, #1a1d27);
  border: 1px solid var(--border, #2d3148);
  border-radius: 8px;
  overflow: hidden;
}

.accordion-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text, #e2e8f0);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.15s;
}
.accordion-summary:hover { background: var(--surface-2, #22253a); }
.accordion-summary::-webkit-details-marker { display: none; }

.accordion-icon {
  font-size: 0.65rem;
  color: var(--muted, #8892a4);
  transition: transform 0.2s;
  display: inline-block;
}
details[open] .accordion-icon { transform: rotate(90deg); }

.accordion-body {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border, #2d3148);
}

/* ── Mechanism text ─────────────────────────────────── */
.mechanism-text {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--muted, #8892a4);
}
.mechanism-text strong { color: var(--text, #e2e8f0); font-weight: 600; }
.mechanism-text em { color: var(--text, #e2e8f0); }
.mechanism-text code {
  background: var(--code-bg, #151820);
  color: var(--code-text, #c9d1d9);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.85em;
  font-family: "Fira Code", "Cascadia Code", "Courier New", monospace;
}
.mechanism-text br { display: block; content: ''; margin: 0.4em 0; }

/* ── Mitigations ────────────────────────────────────── */
.mitigations {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.mitigation-item {
  padding-left: 0.75rem;
  border-left: 3px solid var(--accent-2);
}

.mitigation-strategy {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-2);
  margin-bottom: 0.25rem;
}

.mitigation-desc {
  font-size: 0.83rem;
  color: var(--muted, #8892a4);
  line-height: 1.6;
}

/* ── Response plain (un-revealed) ───────────────────── */
.response-plain {
  white-space: pre-wrap;
}

/* ── Mobile ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .page-header { padding: 1rem 1rem 0.5rem; }
  .page-header h1 { font-size: 1.3rem; }
  .main-content { padding: 1rem 0.75rem; }
  .type-tab { font-size: 0.75rem; padding: 0.5rem 0.75rem; }
  .chat-row { padding: 0.6rem 0.75rem; }
}
