/* ============================================================
   LoKI – Beispielchat
   Einbinden: <link rel="stylesheet" href="loki.css">
   Der Seitenrahmen bleibt in loki.html. Diese Datei gestaltet
   nur das Chat-Fenster.
   ============================================================ */

:root {
  --loki-primary:          #629c3d;
  --loki-primary-dark:     #4f7d2f;
  --loki-primary-contrast: #ffffff;
  --loki-bg:               #ecebe4;
  --loki-bg-hover:         #e4e3dc;
  --loki-surface:          #ffffff;
  --loki-border:           #d0cfca;
  --loki-text:             #1f2121;
  --loki-text-muted:       #5e6265;
  --loki-badge-bg:         #e4edd0;
  --loki-badge-text:       #3d6520;
  --loki-citation-bg:      #edf0e5;
  --loki-bubble-bg:        #2d4a1e;
  --loki-bubble-text:      #e0f0cc;
  --loki-hinweis-bg:       #fbf0e2;
  --loki-hinweis-border:   #d98618;
  --loki-hinweis-text:     #7a4c0e;
  --loki-unbelegt-bg:      #fdeeee;
  --loki-unbelegt-border:  #d9534f;
  --loki-unbelegt-text:    #7a2320;
  --loki-eingeschraenkt-bg:   #fef3cd;
  --loki-eingeschraenkt-text: #856404;
  --loki-radius:           10px;
  --loki-radius-lg:        16px;
  --loki-font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.loki-chat {
  background: var(--loki-bg);
  border: 1px solid var(--loki-border);
  border-radius: var(--loki-radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.10);
  font-family: var(--loki-font);
  color: var(--loki-text);
}

.loki-chat-kopf {
  background: var(--loki-surface);
  border-bottom: 2px solid var(--loki-primary);
  height: 52px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.loki-chat-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--loki-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.loki-chat-logo svg { display: block; }

.loki-chat-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--loki-text);
}

.loki-chat-kopf-badge {
  margin-left: auto;
  font-size: 0.72rem;
  background: var(--loki-badge-bg);
  color: var(--loki-badge-text);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.loki-chat-verlauf {
  padding: 24px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 220px;
  max-height: 560px;
  overflow-y: auto;
}

.loki-chat-verlauf::-webkit-scrollbar { width: 8px; }
.loki-chat-verlauf::-webkit-scrollbar-thumb {
  background: var(--loki-border);
  border-radius: 999px;
}

.loki-chat-leer {
  margin: auto;
  padding: 28px 12px;
  text-align: center;
  color: var(--loki-text-muted);
  font-size: 0.95rem;
}

.loki-turn {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: loki-in .35s ease;
}

@keyframes loki-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.loki-frage {
  align-self: flex-end;
  background: var(--loki-bubble-bg);
  color: var(--loki-bubble-text);
  padding: 8px 16px;
  border-radius: 14px 14px 3px 14px;
  max-width: 82%;
  line-height: 1.5;
  font-size: 0.95rem;
}

.loki-antwort {
  align-self: flex-start;
  background: var(--loki-surface);
  border: 1px solid var(--loki-border);
  border-radius: 3px 14px 14px 14px;
  padding: 16px;
  max-width: 100%;
  width: 100%;
}

.loki-ki-label {
  display: inline-block;
  color: var(--loki-primary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
  margin-right: 8px;
}

.loki-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.loki-badge--ok {
  background: var(--loki-badge-bg);
  color: var(--loki-badge-text);
}

.loki-badge--warn {
  background: var(--loki-eingeschraenkt-bg);
  color: var(--loki-eingeschraenkt-text);
}

.loki-text {
  line-height: 1.6;
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.loki-text p { margin: 0 0 0.65em; }
.loki-text p:last-child { margin-bottom: 0; }
.loki-text strong { font-weight: 600; }

.loki-text table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 0.65em;
  font-size: 0.88em;
}

.loki-text th,
.loki-text td {
  border: 1px solid var(--loki-border);
  padding: 0.35em 0.6em;
  text-align: left;
}

.loki-text th {
  background: var(--loki-citation-bg);
  font-weight: 600;
}

.loki-quellen {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.loki-quellen-titel {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--loki-text-muted);
  margin-bottom: 4px;
}

.loki-quelle {
  background: var(--loki-citation-bg);
  border-radius: var(--loki-radius);
  padding: 4px 10px;
  font-size: 0.83rem;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: baseline;
}

.loki-quelle-name { font-weight: 600; }
.loki-quelle-stand { color: var(--loki-text-muted); }
.loki-quelle-seite {
  font-size: 0.75rem;
  color: var(--loki-text-muted);
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
  padding: 0 5px;
}

.loki-block {
  margin-top: 10px;
  border-radius: var(--loki-radius);
  padding: 8px 14px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.loki-block-titel {
  font-weight: 600;
  margin-bottom: 4px;
}

.loki-block--unbelegt {
  background: var(--loki-unbelegt-bg);
  border: 1px solid var(--loki-unbelegt-border);
  color: var(--loki-unbelegt-text);
}

.loki-block--unbelegt ul {
  margin: 0;
  padding-left: 1.2em;
}

.loki-block--unbelegt li { margin-bottom: 2px; }

.loki-block--hinweis {
  background: var(--loki-hinweis-bg);
  border: 1px solid var(--loki-hinweis-border);
  color: var(--loki-hinweis-text);
}

.loki-fachbereich {
  margin-top: 12px;
  background: var(--loki-hinweis-bg);
  border: 1px solid var(--loki-hinweis-border);
  border-radius: var(--loki-radius);
  overflow: hidden;
}

.loki-fachbereich-kopf {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--loki-hinweis-border);
}

.loki-fachbereich-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: #fff;
  flex: 1;
}

.loki-fachbereich-nr {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  padding: 1px 6px;
}

.loki-fachbereich-body {
  padding: 8px 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 0.85rem;
}

.loki-fachbereich-label {
  color: var(--loki-hinweis-text);
  font-weight: 600;
  white-space: nowrap;
}

.loki-fachbereich-value { color: var(--loki-text); }

.loki-composer {
  margin: 0 20px 20px;
  background: var(--loki-surface);
  border: 1px solid var(--loki-border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.loki-frage-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.loki-nav-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid var(--loki-border);
  border-radius: 8px;
  background: var(--loki-surface);
  color: var(--loki-text);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.loki-nav-btn:hover:not(:disabled) {
  border-color: var(--loki-primary);
  color: var(--loki-primary);
}

.loki-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.loki-frage-anzeige {
  flex: 1;
  min-width: 0;
  background: var(--loki-bubble-bg);
  color: var(--loki-bubble-text);
  border-radius: 14px 14px 3px 14px;
  padding: 12px 16px;
}

.loki-frage-text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  font-weight: 600;
}

.loki-frage-dots {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.loki-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(224, 240, 204, 0.28);
}

.loki-dot.is-active {
  background: #b7e39a;
}

.loki-composer-senden {
  display: flex;
  justify-content: flex-end;
}

#loki-senden {
  background: var(--loki-primary);
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
}

#loki-senden:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#loki-senden:not(:disabled):hover {
  background: var(--loki-primary-dark);
}

#loki-senden:focus-visible,
.loki-nav-btn:focus-visible {
  outline: 2px solid var(--loki-primary);
  outline-offset: 2px;
}

.loki-typing {
  align-self: flex-start;
  background: var(--loki-surface);
  border: 1px solid var(--loki-border);
  border-radius: 3px 14px 14px 14px;
  padding: 12px 16px;
  color: var(--loki-text-muted);
  font-size: 0.88rem;
}

.loki-pruefung {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: 8px;
  background: var(--loki-citation-bg);
  border: 1px solid var(--loki-border);
  color: var(--loki-text-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.loki-pruefung-spinner {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid var(--loki-border);
  border-top-color: var(--loki-primary);
  border-radius: 50%;
  animation: loki-spin .7s linear infinite;
}

@keyframes loki-spin {
  to { transform: rotate(360deg); }
}

.loki-cta-zeile {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.loki-cta-hinweis {
  font-size: 0.85rem;
  color: var(--loki-text-muted);
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  .loki-turn { animation: none; }
  .loki-pruefung-spinner { animation: none; border-top-color: var(--loki-primary); }
}
