:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #666666;
  --border: #dddddd;
  --accent: #1a56db;
  --bubble-user: #eef2ff;
  --bubble-assistant: #f7f7f8;
  --danger-bg: #fdecea;
  --danger-fg: #7a1f14;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --fg: #f0f0f0;
    --muted: #a0a0a0;
    --border: #33353a;
    --accent: #6690f2;
    --bubble-user: #1f2a44;
    --bubble-assistant: #1c1d20;
    --danger-bg: #3a1e1a;
    --danger-fg: #f2b8ae;
  }
}

* { box-sizing: border-box; }

/* Solange keine Cookie-Consent-Entscheidung getroffen wurde (siehe app.js/
 * klaro-config.js), wird der eigentliche Seiteninhalt verwaschen und ist
 * nicht bedienbar. Der Klaro-Consent-Dialog selbst (id="klaro", von Klaro
 * automatisch als eigenes body-Kind eingehaengt) bleibt davon unberuehrt. */
body.consent-pending > *:not(#klaro) {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
  transition: filter 0.2s ease-out;
}

/* Klaro rendert die Footer-Buttons des Consent-Dialogs standardmaessig in
 * der Reihenfolge "Ablehnen - Ausgewaehlte akzeptieren - Alle akzeptieren".
 * Per Vorgabe soll "Alle akzeptieren" in der Mitte stehen: "Ablehnen -
 * Alle akzeptieren - Ausgewaehlte akzeptieren". .cm-footer-buttons ist bei
 * Klaro ein Flex-Container, daher genuegt eine Neusortierung per order. */
.klaro .cm-footer-buttons .cm-btn-decline { order: 1; }
.klaro .cm-footer-buttons .cm-btn-accept-all { order: 2; }
.klaro .cm-footer-buttons .cm-btn-accept { order: 3; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.topbar h1 {
  font-size: 1.25rem;
  margin: 0;
}

.topbar-link {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.topbar a:first-of-type {
  margin-left: auto;
}

.topbar-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1.1rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  color: var(--fg);
}

.settings-panel {
  position: absolute;
  top: 3.2rem;
  left: 1rem;
  z-index: 10;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.settings-panel.hidden { display: none; }

.settings-panel label {
  font-size: 0.9rem;
  display: block;
  margin-bottom: 0.4rem;
}

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

.msg {
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.9rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.msg-user {
  background: var(--bubble-user);
}

.msg-assistant {
  background: var(--bubble-assistant);
  border: 1px solid var(--border);
}

.msg-status {
  color: var(--muted);
  font-style: italic;
}

.msg-error {
  background: var(--danger-bg);
  color: var(--danger-fg);
}

.hit {
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}

.hit:first-child { border-top: none; }

.hit-title { margin: 0.2rem 0; font-weight: 600; }

.hit-links { margin: 0.2rem 0; }

.hit-links a {
  color: var(--accent);
  text-decoration: none;
  margin-right: 0.75rem;
}

.hit-links a:hover { text-decoration: underline; }

.hit-quote {
  margin: 0.4rem 0 0.2rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--border);
  color: var(--fg);
}

.banner {
  max-width: 860px;
  margin: 0 auto 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--danger-bg);
  color: var(--danger-fg);
  border-radius: 8px;
  width: calc(100% - 2rem);
}

.banner.hidden { display: none; }

.intro {
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.intro.hidden { display: none; }

.disclaimer {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.disclaimer p {
  margin: 0 0 0.4rem;
  font-weight: 600;
}

.disclaimer ul {
  margin: 0;
  padding-left: 1.2rem;
}

.disclaimer li {
  margin-bottom: 0.3rem;
}

.disclaimer a {
  color: var(--accent);
}

.disclaimer.hidden { display: none; }

.query-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1.25rem;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  border-top: 1px solid var(--border);
}

.query-form input[type="text"] {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 1rem;
}

.query-form button {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  cursor: pointer;
}

.query-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
