/* =========================================================================
   Live-Demo-Seite "Digitaler Gastgeber" (Orvanta)
   Palette: Graphit & Gletscherblau. Vanilla CSS, passend zur Landing-Page.
   ========================================================================= */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --ink: #17191d;
  --muted: #5b616b;
  --line: #e7e9ee;
  --accent: #2f5aa6;
  --accent-ink: #ffffff;
  --accent-soft: #eef2fb;

  --sh-sm: 0 1px 2px rgba(23, 25, 29, .05);
  --sh-card: 0 2px 6px rgba(23, 25, 29, .05), 0 34px 80px rgba(23, 40, 70, .16);

  --r-lg: 22px;
  --r-md: 13px;
  --r-sm: 11px;

  --bar: 62px;
  --wrap: 1140px;
  --pad: clamp(20px, 5vw, 44px);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
          Roboto, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

:root[data-theme="dark"] {
  --bg: #0f1116;
  --surface: #161920;
  --surface-2: #1f232b;
  --ink: #eef0f4;
  --muted: #a0a6b0;
  --line: #262b34;
  --accent: #6f9be6;
  --accent-ink: #0e1013;
  --accent-soft: #182640;
  --sh-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --sh-card: 0 34px 80px rgba(0, 0, 0, .58);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0f1116;
    --surface: #161920;
    --surface-2: #1f232b;
    --ink: #eef0f4;
    --muted: #a0a6b0;
    --line: #262b34;
    --accent: #6f9be6;
    --accent-ink: #0e1013;
    --accent-soft: #182640;
    --sh-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --sh-card: 0 34px 80px rgba(0, 0, 0, .58);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
h1 { margin: 0; font-weight: 640; letter-spacing: -0.03em; line-height: 1.1; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }

/* ---- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--r-md);
  border: 1px solid transparent; font: inherit; font-weight: 550;
  cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
}
.btn--quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--quiet:hover { background: var(--surface); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }

/* ---- Kopfleiste ------------------------------------------------------- */
.dbar {
  position: sticky; top: 0; z-index: 50; height: var(--bar);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 var(--pad);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brandlink { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.logo { display: inline-flex; filter: drop-shadow(0 4px 10px rgba(47,90,166,.22)); }
.logo svg { display: block; border-radius: 8px; }
.brandlink__name { font-weight: 660; font-size: 18px; letter-spacing: -0.03em; }
.dbar__right { display: flex; align-items: center; gap: 14px; }
.dbar__link { color: var(--muted); font-size: 14.5px; }
.dbar__link:hover { color: var(--ink); }
.theme-toggle {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.theme-toggle:hover { background: var(--surface-2); border-color: var(--muted); }
.theme-toggle .ic-sun { display: none; }
.theme-toggle .ic-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .ic-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .ic-moon { display: none; }

/* ---- Seitenlayout (Intro links, Chat rechts) ------------------------- */
.dmain {
  max-width: var(--wrap); margin: 0 auto; padding: clamp(24px, 4vw, 48px) var(--pad);
  min-height: calc(100dvh - var(--bar));
  display: grid; grid-template-columns: 0.92fr 1.08fr;
  gap: clamp(32px, 6vw, 72px); align-items: center;
}
.dintro { max-width: 440px; }
.dintro__title { font-size: clamp(28px, 3.4vw, 40px); margin-bottom: 18px; }
.dintro__lead { color: var(--muted); font-size: 18px; margin-bottom: 24px; max-width: 38ch; }
.dintro__points { list-style: none; margin: 0 0 30px; padding: 0; display: grid; gap: 12px; }
.dintro__points li {
  position: relative; padding-left: 28px;
  color: var(--ink); font-size: 15.5px;
}
.dintro__points li::before {
  content: ""; position: absolute; left: 0; top: 6px;
  width: 15px; height: 9px;
  border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

/* ---- Chat-Buehne (Glow + Chat + Bildunterschrift) -------------------- */
.dstage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.dstage::before {
  content: ""; position: absolute; inset: -8% -6% auto -6%; height: 60%;
  background: radial-gradient(60% 100% at 55% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 72%);
  filter: blur(16px); z-index: 0; pointer-events: none;
}
.dcaption { position: relative; z-index: 1; font-size: 12.5px; color: var(--muted); text-align: center; max-width: 42ch; }

/* ---- Chat-Karte ------------------------------------------------------- */
.chat {
  position: relative; z-index: 1;
  width: 100%; max-width: 460px;
  height: min(704px, calc(100dvh - 168px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-card);
  display: flex; flex-direction: column; overflow: hidden;
}

.chat__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__avatar {
  flex: none; width: 40px; height: 40px;
  display: grid; place-items: center; border-radius: 12px;
  background: var(--accent); color: #fff;
  font-weight: 680; font-size: 17px; letter-spacing: -0.02em;
  box-shadow: 0 4px 12px rgba(47, 90, 166, .28);
}
.brand__text { min-width: 0; }
.brand__name { font-weight: 640; font-size: 16px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand__sub { font-size: 12.5px; color: var(--muted); }
.status { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.status__dot { width: 8px; height: 8px; border-radius: 50%; background: #3fae74; box-shadow: 0 0 0 3px rgba(63,174,116,.16); }

/* Nachrichten */
.messages { flex: 1; overflow-y: auto; padding: 22px 18px 10px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.line { display: flex; flex-direction: column; }
.line--guest { align-items: flex-end; }
.line--bot { align-items: flex-start; }
.msg {
  max-width: 84%; padding: 11px 15px; border-radius: 17px;
  font-size: 15px; line-height: 1.5; white-space: pre-wrap;
  word-wrap: break-word; overflow-wrap: anywhere;
  animation: rise .24s var(--ease) both;
}
.msg--bot { background: var(--surface-2); color: var(--ink); border-bottom-left-radius: 5px; }
.msg--guest { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 5px; }
.time { font-size: 11px; color: var(--muted); margin: 4px 5px 0; }
@keyframes rise { from { opacity: 0; transform: translateY(7px) scale(.99); } to { opacity: 1; transform: none; } }

/* Tipp-Anzeige */
.typing { align-self: flex-start; display: inline-flex; gap: 5px; padding: 14px 16px; background: var(--surface-2); border-radius: 17px; border-bottom-left-radius: 5px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--muted) 60%, transparent); animation: blink 1.3s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .18s; }
.typing span:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%,80%,100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Beispiel-Fragen: horizontale Leiste */
.suggest {
  display: flex; gap: 8px; padding: 6px 18px 14px;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 24px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 24px), transparent 100%);
}
.suggest::-webkit-scrollbar { display: none; }
.suggest:empty { display: none; }
.chip {
  flex: none; scroll-snap-align: start; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--accent);
  font: inherit; font-size: 13.5px; font-weight: 500; padding: 8px 14px; border-radius: 999px;
  cursor: pointer; transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
}
.chip:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.chip:active { transform: translateY(1px); }

/* Eingabezeile */
.composer { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-top: 1px solid var(--line); background: var(--surface); }
.composer__input {
  flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg);
  border-radius: var(--r-md); padding: 12px 15px; font: inherit; font-size: 16px; color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.composer__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer__send {
  flex: none; width: 46px; height: 46px; display: grid; place-items: center;
  border: none; border-radius: var(--r-md); background: var(--accent); color: var(--accent-ink);
  cursor: pointer; box-shadow: var(--sh-sm);
  transition: transform .1s var(--ease), opacity .15s var(--ease);
}
.composer__send:hover { opacity: .93; }
.composer__send:active { transform: translateY(1px); }
.composer__send:disabled { opacity: .45; cursor: default; }

/* ---- Embed (im iframe des Widgets): Chat fuellt die Flaeche ----------- */
body.embed { height: 100%; background: transparent; }
.embed .chat {
  max-width: none; width: 100%; height: 100dvh;
  border: none; border-radius: 0; box-shadow: none;
}

/* ---- Handy: Chat fuellt den Bildschirm unter der schlanken Leiste ----- */
@media (max-width: 900px) {
  .dintro { display: none; }
  .dmain {
    display: block; padding: 0; min-height: 0;
  }
  .dstage { gap: 0; }
  .dstage::before { display: none; }
  .dcaption { display: none; }
  .chat {
    max-width: none; width: 100%;
    height: calc(100dvh - var(--bar));
    border: none; border-radius: 0; box-shadow: none;
  }
}
@media (max-width: 420px) {
  .dbar__link { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .msg, .typing span { animation: none; }
  .messages { scroll-behavior: auto; }
}
