/* public/widget.css — WB Kanzlei-Chatbot Design-Tokens + Widget-Styles */

:root {
  /* WB-Markenfarben — aus dem produktiven Elementor-CSS extrahiert */
  --wb-primary: #576167; /* Schiefergrau — Marken-Tiefe */
  --wb-secondary: #ae8135; /* Gold — einziger, sparsamer Akzent */
  --wb-secondary-light: #fdcd76; /* helles Gold (Verläufe/Hover-Tiefe) */
  --wb-accent: #c8ccce; /* helles Grau */
  --wb-gold: var(--wb-secondary); /* Alias — Bestandscode/Tests bleiben gültig */
  --wb-text-on-dark: #fff;

  --wb-ink: #2b3134; /* Text dunkel */
  --wb-paper: #ffffff; /* Flächen */
  --wb-paper-2: #f6f7f8; /* gedämpfte Fläche */
  --wb-line: #e3e6e7; /* Trennlinien */
  --wb-muted: #6c757a; /* Sekundärtext */
  --wb-danger: #9b2c2c; /* Fehler */

  /* 10px Radius überall (WB-Standard) */
  --wb-radius: 10px;
  --wb-radius-sm: 10px;
  --wb-gap: 14px;
  /* Moderne, weiche Schatten statt WBs hartem 0 0 10px rgba(0,0,0,.5) */
  --wb-shadow-soft: 0 4px 20px rgba(87, 97, 103, 0.12);
  --wb-shadow: 0 12px 36px rgba(87, 97, 103, 0.16);
  --wb-shadow-sm: 0 2px 10px rgba(87, 97, 103, 0.08);

  /* WB-Markenschrift — bewusst NUR Roboto */
  --wb-font: 'Roboto', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial,
    sans-serif;
  /* WB-Standard-Transition (dur + timing) sowie die reine Timing-Function */
  --wb-ease: 0.3s ease-in-out;
  --wb-ease-fn: ease-in-out;
}

/* Wurzel-Container — weiße Karte, weicher Schatten, 10px-Radius */
.wbchat {
  font-family: var(--wb-font);
  color: var(--wb-ink);
  background: var(--wb-paper);
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius);
  box-shadow: var(--wb-shadow-soft);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 760px;
  overflow: hidden;
}

/* Kopfzeile (optional via index.html gesetzt) — Schiefergrau mit Gold-Hairline */
.wbchat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 22px;
  background: var(--wb-primary);
  color: var(--wb-text-on-dark);
  border-bottom: 2px solid var(--wb-secondary);
}
.wbchat-head-title {
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.2px;
}
.wbchat-head-sub {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.82;
}

/* Verlauf — luftig, sehr helle Fläche */
.wbchat-log {
  flex: 1 1 auto;
  min-height: 360px;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: var(--wb-gap);
  background: var(--wb-paper-2);
  scroll-behavior: smooth;
}

/* Nachrichten */
.wbchat-msg {
  display: flex;
}
.wbchat-msg--user {
  justify-content: flex-end;
}
.wbchat-msg--assistant {
  justify-content: flex-start;
  flex-direction: column;
  align-items: flex-start;
}

.wbchat-bubble {
  max-width: 84%;
  padding: 12px 16px;
  border-radius: var(--wb-radius-sm);
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.wbchat-msg--assistant .wbchat-bubble {
  background: var(--wb-paper);
  border: 1px solid var(--wb-line);
  border-top-left-radius: 4px;
  box-shadow: var(--wb-shadow-sm);
}
.wbchat-msg--user .wbchat-bubble {
  background: var(--wb-primary);
  color: var(--wb-text-on-dark);
  border-top-right-radius: 4px;
}

/* Angebots-Karte (leistung) — klar abgesetzt, Gold-Akzentkante links */
.wbchat-source {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-self: stretch;
  max-width: 100%;
  margin-top: 6px;
  padding: 16px 18px 17px;
  text-decoration: none;
  color: var(--wb-ink);
  background: linear-gradient(180deg, var(--wb-paper) 0%, #fdfaf4 100%);
  border: 1px solid var(--wb-line);
  border-left: 3px solid var(--wb-secondary);
  border-radius: var(--wb-radius-sm);
  box-shadow: var(--wb-shadow-sm);
  transition: transform 220ms var(--wb-ease-fn), box-shadow 220ms var(--wb-ease-fn),
    border-color 220ms var(--wb-ease-fn);
}
.wbchat-source-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--wb-secondary);
  font-weight: 500;
}
.wbchat-source-kicker::before {
  content: '';
  width: 16px;
  height: 2px;
  background: var(--wb-secondary);
}
.wbchat-source-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--wb-primary);
}
.wbchat-source-benefit {
  font-size: 14px;
  line-height: 1.55;
  color: var(--wb-muted);
}
.wbchat-source-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.wbchat-source-link {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--wb-secondary);
  transition: opacity 180ms var(--wb-ease-fn);
}
.wbchat-source:hover {
  transform: translateY(-2px);
  box-shadow: var(--wb-shadow);
  border-left-color: var(--wb-secondary-light);
}
.wbchat-source:hover .wbchat-source-link {
  opacity: 0.7;
}
.wbchat-source:focus-visible {
  outline: 2px solid var(--wb-gold);
  outline-offset: 2px;
}
.wbchat-source:active {
  transform: translateY(0);
}

/* Erstgespräch-CTA in der Angebots-Karte */
.wbchat-source-cta {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  background: var(--wb-secondary);
  color: #1f1a0f;
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 10px rgba(174, 129, 53, 0.28);
  transition: transform 180ms var(--wb-ease-fn), box-shadow 180ms var(--wb-ease-fn),
    background-color 180ms var(--wb-ease-fn);
}
.wbchat-source-cta:hover {
  background: var(--wb-secondary-light);
  transform: translateY(-1px);
}
.wbchat-source-cta:focus-visible {
  outline: 2px solid var(--wb-primary);
  outline-offset: 2px;
}
.wbchat-source-cta:active {
  transform: translateY(0);
  opacity: 0.9;
}

/* Lead-Bestätigung */
.wbchat-lead {
  align-self: stretch;
  padding: 16px 18px;
  background: var(--wb-paper);
  border: 1px solid var(--wb-line);
  border-top: 2px solid var(--wb-secondary);
  border-radius: var(--wb-radius-sm);
  box-shadow: var(--wb-shadow-sm);
}
.wbchat-lead-head {
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--wb-primary);
}
.wbchat-lead-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}
.wbchat-lead-dt {
  color: var(--wb-muted);
}
.wbchat-lead-dd {
  margin: 0;
  font-weight: 500;
}
.wbchat-lead-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--wb-muted);
}

/* Handoff */
.wbchat-handoff {
  align-self: stretch;
  padding: 16px 18px;
  background: var(--wb-paper);
  border: 1px dashed var(--wb-secondary);
  border-radius: var(--wb-radius-sm);
  text-align: center;
}
.wbchat-handoff-text {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.55;
}
.wbchat-handoff-btn,
.wbchat-send,
.wbchat-chip {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 999px;
  transition: transform 180ms var(--wb-ease-fn), opacity 180ms var(--wb-ease-fn),
    background-color 180ms var(--wb-ease-fn), border-color 180ms var(--wb-ease-fn),
    box-shadow 180ms var(--wb-ease-fn);
}
.wbchat-handoff-btn {
  padding: 10px 20px;
  background: var(--wb-secondary);
  color: #1f1a0f;
  font-weight: 500;
  font-size: 13.5px;
  box-shadow: 0 2px 10px rgba(174, 129, 53, 0.28);
}
.wbchat-handoff-btn:hover {
  transform: translateY(-1px);
  background: var(--wb-secondary-light);
}
.wbchat-handoff-btn:focus-visible {
  outline: 2px solid var(--wb-primary);
  outline-offset: 2px;
}
.wbchat-handoff-btn:active {
  transform: translateY(0);
  opacity: 0.9;
}

/* Erinnerungs-Hinweis nach jeder KI-Antwort (offizieller WB-Disclaimer, Text 3).
   Bewusst klein, gedämpft und unaufdringlich — sitzt direkt unter der Antwort. */
.wbchat-disclaimer-note {
  align-self: flex-start;
  max-width: 92%;
  margin-top: 2px;
  padding: 8px 11px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--wb-muted);
  background: color-mix(in srgb, var(--wb-paper-2) 70%, transparent);
  border-left: 2px solid var(--wb-accent);
  border-radius: var(--wb-radius-sm);
  /* dezent einblenden, ohne Layout-Ruckeln: nur opacity/transform */
  animation: wbchat-note-in 240ms var(--wb-ease-fn) both;
}
@keyframes wbchat-note-in {
  from {
    opacity: 0;
    transform: translateY(-2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fehler */
.wbchat-error {
  align-self: stretch;
  padding: 10px 14px;
  background: #fcebe9;
  border: 1px solid #f3c6c1;
  border-radius: var(--wb-radius-sm);
  color: var(--wb-danger);
  font-size: 13px;
}

/* Chips — Pills mit Gold-Hover */
.wbchat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 22px;
  background: var(--wb-paper);
  border-top: 1px solid var(--wb-line);
}
.wbchat-chips--catalog {
  padding-top: 2px;
  border-top: none;
}
.wbchat-chips--catalog::before {
  content: 'Themen';
  flex-basis: 100%;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--wb-muted);
  font-weight: 500;
  margin-bottom: 2px;
}
.wbchat-chip {
  padding: 9px 16px;
  background: var(--wb-paper-2);
  color: var(--wb-primary);
  border: 1px solid var(--wb-line);
  font-size: 13.5px;
  font-weight: 500;
}
.wbchat-chip--catalog {
  background: transparent;
  color: var(--wb-muted);
  font-weight: 500;
}
.wbchat-chip:hover {
  transform: translateY(-1px);
  border-color: var(--wb-secondary);
  color: var(--wb-secondary);
  box-shadow: 0 2px 10px rgba(174, 129, 53, 0.14);
}
.wbchat-chip:focus-visible {
  outline: 2px solid var(--wb-secondary);
  outline-offset: 2px;
}
.wbchat-chip:active {
  transform: translateY(0);
  opacity: 0.9;
}

/* Komposer */
.wbchat-composer {
  display: flex;
  gap: 10px;
  padding: 16px 22px 20px;
  background: var(--wb-paper);
  border-top: 1px solid var(--wb-line);
}
.wbchat-input {
  flex: 1 1 auto;
  font-family: inherit;
  font-size: 15px;
  padding: 12px 16px;
  color: var(--wb-ink);
  background: var(--wb-paper-2);
  border: 1px solid var(--wb-line);
  border-radius: 999px;
  outline: none;
  transition: border-color 180ms var(--wb-ease-fn),
    box-shadow 180ms var(--wb-ease-fn);
}
.wbchat-input:focus-visible {
  border-color: var(--wb-secondary);
  outline: 2px solid color-mix(in srgb, var(--wb-secondary) 32%, transparent);
  outline-offset: 1px;
}
.wbchat-input:disabled {
  opacity: 0.6;
}
.wbchat-send {
  padding: 12px 22px;
  background: var(--wb-primary);
  color: var(--wb-text-on-dark);
  font-weight: 500;
  font-size: 14.5px;
}
.wbchat-send:hover {
  transform: translateY(-1px);
  box-shadow: var(--wb-shadow-sm);
}
.wbchat-send:focus-visible {
  outline: 2px solid var(--wb-gold);
  outline-offset: 2px;
}
.wbchat-send:active {
  transform: translateY(0);
  opacity: 0.9;
}
.wbchat-send:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

/* Streaming-Indikator */
.wbchat.is-streaming .wbchat-send {
  opacity: 0.7;
}

/* Reduced Motion respektieren */
@media (prefers-reduced-motion: reduce) {
  .wbchat-source,
  .wbchat-source-cta,
  .wbchat-source-link,
  .wbchat-chip,
  .wbchat-send,
  .wbchat-handoff-btn,
  .wbchat-input,
  .wbchat-log {
    transition: none;
    scroll-behavior: auto;
  }
  .wbchat-disclaimer-note {
    animation: none;
  }
}
