/* bestatter.digital – Chat-Widget (Panel). Der Auslöser ist der Button .fab-main aus layout.css. */

#bd-chat {
  position: fixed; right: 20px; bottom: 90px; z-index: 81;
  display: flex; flex-direction: column;
  width: min(390px, calc(100vw - 32px)); height: min(620px, calc(100vh - 120px));
  background: var(--paper); color: var(--ink);
  border: 1px solid #22392e1f; border-radius: 24px; overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5);
  font-family: var(--sans); font-size: .92rem; line-height: 1.5;
  opacity: 0; transform: translateY(14px) scale(.98); transform-origin: bottom right;
  transition: opacity .22s ease, transform .22s ease;
}
#bd-chat[hidden] { display: none; }
#bd-chat.bdc-open { opacity: 1; transform: none; }
#bd-chat *, #bd-chat *::before, #bd-chat *::after { box-sizing: border-box; }
#bd-chat button, #bd-chat textarea { font-family: inherit; margin: 0; }

/* Kopf */
#bd-chat .bdc-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--dg); color: var(--beige); padding: 14px 12px 14px 18px;
}
#bd-chat .bdc-head-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
#bd-chat .bdc-head-av { width: 40px; height: 40px; border-radius: 50%; background: var(--beige); padding: 5px; flex: none; }
#bd-chat .bdc-title { font-weight: 700; font-size: 1rem; line-height: 1.25; }
#bd-chat .bdc-sub { font-size: .74rem; opacity: .78; margin-top: 2px; }
#bd-chat .bdc-close {
  flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; cursor: pointer;
  display: inline-grid; place-items: center; background: transparent; color: inherit; transition: background .15s;
}
#bd-chat .bdc-close:hover { background: #ffffff26; }

/* Verlauf */
#bd-chat .bdc-log {
  flex: 1; overflow-y: auto; padding: 18px 16px 8px; background: var(--beige);
  display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; overscroll-behavior: contain;
}
#bd-chat .bdc-msg { display: flex; align-items: flex-end; gap: 8px; }
#bd-chat .bdc-user { justify-content: flex-end; }
#bd-chat .bdc-msg-av { width: 30px; height: 30px; flex: none; border-radius: 50%; background: #fff; padding: 4px; border: 1px solid #22392e1f; }
#bd-chat .bdc-bubble {
  max-width: 84%; padding: 11px 15px; border-radius: 18px; overflow-wrap: anywhere;
}
#bd-chat .bdc-bot .bdc-bubble { background: #fff; border-bottom-left-radius: 5px; box-shadow: 0 1px 2px #0001; }
#bd-chat .bdc-user .bdc-bubble { background: var(--dg); color: var(--beige); border-bottom-right-radius: 5px; }
#bd-chat .bdc-bubble p { margin: 0 0 8px; }
#bd-chat .bdc-bubble > :last-child { margin-bottom: 0; }
#bd-chat .bdc-bubble ul, #bd-chat .bdc-bubble ol { margin: 0 0 8px; padding-left: 1.25em; display: grid; gap: 3px; }
#bd-chat .bdc-bubble a { color: var(--gold-ink); font-weight: 600; text-underline-offset: 2px; }
#bd-chat .bdc-user .bdc-bubble a { color: inherit; }

/* Vorschläge */
#bd-chat .bdc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 6px 38px; }
#bd-chat .bdc-chip {
  font-size: .82rem; font-weight: 500; line-height: 1.3; text-align: left; cursor: pointer;
  border: 1.5px solid var(--dg); background: transparent; color: var(--dg); border-radius: 99px; padding: 7px 13px;
  transition: background .15s, color .15s;
}
#bd-chat .bdc-chip:hover { background: var(--dg); color: var(--beige); }

/* Tipp-Anzeige */
#bd-chat .bdc-typing { display: inline-flex; gap: 5px; align-items: center; padding: 15px 16px; }
#bd-chat .bdc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #22392e55; animation: bdc-bounce 1.2s infinite ease-in-out; }
#bd-chat .bdc-typing span:nth-child(2) { animation-delay: .18s; }
#bd-chat .bdc-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes bdc-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

/* Eingabe */
#bd-chat .bdc-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px; background: #fff; border-top: 1px solid #22392e1a; }
#bd-chat .bdc-input {
  flex: 1; min-width: 0; resize: none; max-height: 120px; outline: 0;
  border: 1.5px solid #22392e33; border-radius: 18px; background: #fff; color: var(--ink);
  font-size: .92rem; line-height: 1.4; padding: 10px 15px;
}
#bd-chat .bdc-input:focus { border-color: var(--dg); }
#bd-chat .bdc-send {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; cursor: pointer;
  display: inline-grid; place-items: center; background: var(--gold); color: #1b1500; transition: opacity .15s, transform .15s;
}
#bd-chat .bdc-send:hover:not(:disabled) { transform: translateY(-1px); }
#bd-chat .bdc-send:disabled { opacity: .4; cursor: default; }
#bd-chat .bdc-foot { margin: 0; padding: 0 14px 10px; background: #fff; font-size: .68rem; line-height: 1.45; color: var(--muted); text-align: center; }
#bd-chat .bdc-foot a { color: var(--dg); font-weight: 600; }

/* Mobil: Vollbild */
@media (max-width: 600px) {
  #bd-chat { right: 0; left: 0; bottom: 0; width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #bd-chat { transition: none; }
  #bd-chat .bdc-typing span { animation: none; }
  #bd-chat .bdc-log { scroll-behavior: auto; }
}
