/* ════════════════════════════════════════════════════
   components.css – Buttons, Chat, Modals, Toasts, Quellen
   ════════════════════════════════════════════════════ */

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border: none; border-radius: 999px;
  font-size: .85rem; font-weight: 500; transition: transform .15s, background .2s, box-shadow .2s; -webkit-appearance: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--pulse-deep); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: #A8362C; box-shadow: var(--shadow); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--petrol); border: 1px solid var(--petrol); }
.btn-ghost:hover { background: var(--petrol-soft); }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-mid); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: .76rem; }
.btn-icon {
  width: 34px; height: 34px; padding: 0; border-radius: var(--r-sm);
  background: var(--surface2); color: var(--ink-dim); border: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: .95rem;
}
.btn-icon:hover { background: var(--teal-bg); color: var(--teal2); }

/* ── Inputs ── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .76rem; font-weight: 600; color: var(--ink-dim); margin-bottom: 6px; }
.input, .textarea, .select {
  width: 100%; padding: 10px 13px;
  background: var(--surface); border: 1.5px solid var(--border2);
  border-radius: var(--r-sm); font-size: .88rem; color: var(--ink);
  transition: border-color .15s; -webkit-appearance: none;
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--teal); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

/* ── Sidebar Pools/Items ── */
.pool {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; margin-bottom: 6px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r); transition: all .15s;
}
.pool:hover { border-color: var(--teal-mid); background: var(--teal-bg); }
.pool.active { border-color: var(--teal); background: var(--teal-bg); box-shadow: var(--shadow-sm); }
.pool-icon {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: var(--petrol);
  display: flex; align-items: center; justify-content: center; font-size: .95rem;
}
.pool-info { flex: 1; min-width: 0; }
.pool-name { font-size: .84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pool-meta { font-size: .68rem; color: var(--ink-faint); }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin: 4px 0 10px; }
.tab {
  flex: 1; padding: 9px 4px; background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-size: .76rem; font-weight: 600; color: var(--ink-faint); transition: all .15s;
}
.tab.active { color: var(--teal2); border-bottom-color: var(--teal); }

/* ── Chat ── */
.chat-area { flex: 1; overflow-y: auto; padding: 22px; scroll-behavior: smooth; }
.chat-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 26px; }

/* Claude-Stil: Nutzerfrage als Blase rechts, Antwort als ruhiger Fließtext */
.msg { display: flex; flex-direction: column; animation: fadeIn .25s ease; }
.msg.user { align-items: flex-end; }
.msg.ai   { align-items: stretch; }
.msg-av { display: none; }
.msg-role { display: none; }
.msg-body { min-width: 0; }
.msg.user .msg-body { max-width: 82%; }
.msg.user .msg-text {
  background: var(--paper-2);
  border-radius: 18px 18px 5px 18px;
  padding: 12px 17px;
  font-size: .92rem; line-height: 1.6; color: var(--ink);
}
.msg.ai .msg-text {
  font-size: .95rem; line-height: 1.75; color: var(--ink);
  padding: 0 2px;
}
.msg-text strong { color: var(--ink); font-weight: 600; }
.msg-text h4 { font-family: var(--mono); font-size: .68rem; font-weight: 500; color: var(--petrol); margin: 20px 0 7px; text-transform: uppercase; letter-spacing: .16em; }
.msg-text h4:first-child { margin-top: 2px; }
.msg-text p { margin: 8px 0; }
.msg-text ul, .msg-text ol { margin: 8px 0 8px 22px; }
.msg-text li { margin: 4px 0; }

/* Antwort-Optionen bei Rückfragen (antippbare Auswahl) */
.answer-options { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.answer-option {
  padding: 9px 17px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--teal-mid);
  color: var(--petrol); font-size: .86rem; font-weight: 500;
  transition: all .15s;
}
.answer-option:hover { background: var(--petrol-soft); border-color: var(--petrol); }
.answer-option:disabled { opacity: .45; cursor: default; }
.answer-option.chosen { background: var(--petrol); border-color: var(--petrol); color: #fff; }

/* Streaming-Cursor */
.stream-cursor::after {
  content: "▌"; color: var(--petrol); animation: pulse .9s infinite; margin-left: 1px;
}

/* Konfidenz-Badges */
.conf {
  display: inline-block; font-size: .64rem; font-weight: 700; font-family: var(--mono);
  padding: 1px 6px; border-radius: 4px; margin: 0 2px; vertical-align: middle;
  text-transform: uppercase; letter-spacing: .03em;
}
.conf-belegt    { background: var(--teal-bg); color: var(--teal-dark); border: 1px solid var(--teal-mid); }
.conf-abgeleitet{ background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-mid); }
.conf-unsicher  { background: var(--amber-bg); color: var(--amber); border: 1px solid #ecd9a8; }

/* Kritischer Hinweis */
.critical-banner {
  background: var(--red-bg); border: 1.5px solid var(--red-mid); border-left: 4px solid var(--red);
  border-radius: var(--r-sm); padding: 12px 15px; margin-bottom: 12px;
  font-size: .84rem; color: var(--red); font-weight: 600;
  display: flex; gap: 10px; align-items: flex-start;
}

/* Quellen */
.sources { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.sources-label { font-size: .68rem; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.source-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 9px 12px; margin-bottom: 6px; cursor: pointer;
  transition: all .15s;
}
.source-card:hover { border-color: var(--teal-mid); background: var(--teal-bg); }
.source-head { display: flex; align-items: center; gap: 8px; }
.source-name { font-size: .78rem; font-weight: 600; flex: 1; }
.source-page { font-size: .66rem; font-family: var(--mono); color: var(--ink-faint); }
.source-type {
  font-size: .6rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; text-transform: uppercase;
}
.source-type.leitlinie { background: var(--teal-bg); color: var(--teal-dark); }
.source-type.intern    { background: var(--blue-bg); color: var(--blue); }
.source-type.paper     { background: var(--amber-bg); color: var(--amber); }
.source-preview {
  font-size: .76rem; color: var(--ink-dim); line-height: 1.5; margin-top: 7px;
  max-height: 0; overflow: hidden; transition: max-height .2s;
}
.source-card.open .source-preview { max-height: 200px; overflow-y: auto; }

/* Antwort-Aktionen */
.msg-actions { display: flex; gap: 6px; margin-top: 10px; }
.msg-action {
  font-size: .72rem; color: var(--ink-faint); background: none; border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 6px; display: inline-flex; gap: 5px; align-items: center;
}
.msg-action:hover { border-color: var(--teal-mid); color: var(--teal2); background: var(--teal-bg); }
.msg-action.danger:hover { border-color: var(--red-mid); color: var(--red); background: var(--red-bg); }

/* ── Eingabeleiste ── */
.composer { flex-shrink: 0; border-top: 1px solid var(--border); background: var(--surface); padding: 14px 18px; }
.composer-inner { max-width: 780px; margin: 0 auto; }
.composer-box {
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--surface); border: 1.5px solid var(--border2);
  border-radius: var(--r); padding: 8px 10px; transition: border-color .15s;
}
.composer-box:focus-within { border-color: var(--teal); }
.composer-ta {
  flex: 1; border: none; outline: none; resize: none; background: none;
  font-size: .9rem; line-height: 1.5; max-height: 160px; color: var(--ink); padding: 5px 4px;
}
.composer-send {
  width: 38px; height: 38px; border-radius: 999px; border: none;
  background: var(--pulse-deep); color: #fff;
  font-size: 1rem; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.composer-send:hover:not(:disabled) { background: #A8362C; }
.composer-send:disabled { opacity: .5; cursor: not-allowed; }
.composer-hint { font-size: .68rem; color: var(--ink-faint); text-align: center; margin-top: 7px; }

/* DSGVO-Banner */
.dsgvo-banner {
  background: var(--amber-bg); border-bottom: 1px solid #ecd9a8;
  padding: 8px 16px; display: flex; align-items: center; gap: 10px;
  font-size: .74rem; color: var(--amber); flex-shrink: 0;
}
.dsgvo-banner strong { color: var(--ink); }
.dsgvo-x { background: none; border: none; color: var(--amber); margin-left: auto; font-size: 1rem; padding: 2px 6px; border-radius: 5px; }
.dsgvo-x:hover { background: rgba(196,127,18,.12); }

/* ── Leer-/Startzustand ── */
.empty-state { text-align: center; padding: 50px 20px; max-width: 520px; margin: 0 auto; }
.empty-logo { width: 64px; height: 64px; opacity: .85; margin-bottom: 16px; border-radius: 14px; }
.empty-title { font-family: var(--serif); font-size: 1.35rem; font-weight: 500; margin-bottom: 8px; }
.empty-sub { font-size: .86rem; color: var(--ink-dim); line-height: 1.6; margin-bottom: 24px; }
.suggestions { display: flex; flex-direction: column; gap: 8px; }
.suggestion {
  text-align: left; padding: 12px 15px; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--r); font-size: .84rem; color: var(--ink-dim);
  transition: all .15s;
}
.suggestion:hover { border-color: var(--teal-mid); background: var(--teal-bg); color: var(--teal-dark); transform: translateX(3px); }

/* ── Toasts ── */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--teal);
  border-radius: var(--r-sm); padding: 12px 16px; box-shadow: var(--shadow-lg);
  font-size: .84rem; color: var(--ink); min-width: 240px; max-width: 360px;
  display: flex; gap: 10px; align-items: flex-start; animation: fadeIn .25s ease;
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.info    { border-left-color: var(--blue); }
.toast-icon { flex-shrink: 0; }
.toast-msg { flex: 1; line-height: 1.45; }

/* ── Modals ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(16,36,46,.45);
  display: none; align-items: center; justify-content: center; z-index: 2000; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }
.modal {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: min(480px, 96vw); max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-title { font-size: .96rem; font-weight: 700; flex: 1; }
.modal-x { background: none; border: none; font-size: 1.1rem; color: var(--ink-faint); padding: 4px 8px; border-radius: 6px; }
.modal-x:hover { background: var(--surface2); color: var(--ink); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Badges ── */
.badge { font-size: .62rem; font-weight: 700; padding: 2px 7px; border-radius: 5px; font-family: var(--mono); }
.badge-teal { background: var(--teal-bg); color: var(--teal-dark); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-processing { background: var(--blue-bg); color: var(--blue); }
