/* ═══════════════════════════════════════════════════════════════
   LIVE-KI-DEMO · Optik v2 — deutlich ansprechender
   Nutzt globale Brand-Tokens. Avatar, Glow, Markdown-Styling,
   Slide-in-Animationen. Mobile-first.
═══════════════════════════════════════════════════════════════ */
.kidemo-section { position: relative; }

.kidemo-card {
  margin: clamp(28px, 5vh, 48px) auto 0;
  max-width: 880px;
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(184,232,52,0.07), transparent 55%),
    radial-gradient(120% 100% at 100% 100%, rgba(255,138,31,0.06), transparent 55%),
    var(--bg-card);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 70px -30px rgba(0,0,0,0.9), 0 0 0 1px rgba(184,232,52,0.04);
  position: relative;
}
.kidemo-card::before {  /* dünne leuchtende Oberkante */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--lime), var(--orange), transparent);
  opacity: 0.6;
}

/* ── Header ─────────────────────────────────────────────────── */
.kidemo-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px clamp(18px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.025), transparent);
}
.kidemo-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--lime); box-shadow: 0 0 0 4px var(--lime-glow);
  animation: kidemoPulse 2.4s ease-in-out infinite;
}
@keyframes kidemoPulse { 0%,100%{opacity:1; box-shadow:0 0 0 4px var(--lime-glow);} 50%{opacity:.5; box-shadow:0 0 0 7px rgba(184,232,52,0);} }
.kidemo-head-txt { font-family: var(--body); font-weight: 700; font-size: 0.96rem; color: var(--cream); letter-spacing: .2px; }
.kidemo-head-txt span { color: var(--muted); font-weight: 500; }
.kidemo-head-badge {
  margin-left: auto; font-family: var(--body); font-weight: 700;
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1px;
  color: var(--lime); border: 1px solid rgba(184,232,52,0.35);
  border-radius: 99px; padding: 4px 11px; white-space: nowrap;
}

/* ── Chips ──────────────────────────────────────────────────── */
.kidemo-chips {
  display: flex; flex-wrap: wrap; gap: 9px;
  padding: clamp(18px, 3vw, 24px) clamp(18px, 3vw, 28px) 6px;
}
.kidemo-chip {
  font-family: var(--body); font-size: 0.88rem; font-weight: 600;
  color: var(--cream);
  background: linear-gradient(180deg, var(--bg-elev), var(--bg-card));
  border: 1px solid var(--line-2); border-radius: 99px;
  padding: 9px 15px; cursor: pointer; transition: all .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.kidemo-chip:hover, .kidemo-chip:focus-visible {
  border-color: var(--lime); color: var(--lime);
  box-shadow: 0 0 0 3px var(--lime-glow); transform: translateY(-1px); outline: none;
}
.kidemo-chip:active { transform: translateY(0); }

/* ── Verlauf ────────────────────────────────────────────────── */
.kidemo-thread {
  padding: clamp(8px, 2vw, 14px) clamp(18px, 3vw, 28px);
  display: flex; flex-direction: column; gap: 16px;
}
.kidemo-thread:empty { display: none; }

.kidemo-row { display: flex; gap: 11px; align-items: flex-end; animation: kidemoIn .34s cubic-bezier(.2,.7,.3,1) both; }
.kidemo-row--user { justify-content: flex-end; }
@keyframes kidemoIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Avatar */
.kidemo-avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 30%, rgba(184,232,52,0.25), var(--bg-elev));
  border: 1px solid rgba(184,232,52,0.4);
  box-shadow: 0 0 18px -6px var(--lime);
  color: var(--lime);
}
.kidemo-avatar svg { width: 18px; height: 18px; }
.kidemo-avatar.is-error { color: var(--warn); border-color: rgba(232,93,79,0.4); background: radial-gradient(circle at 30% 30%, rgba(232,93,79,0.2), var(--bg-elev)); box-shadow: none; }

/* Bubbles */
.kidemo-msg {
  font-family: var(--body); font-size: 0.97rem; line-height: 1.6;
  padding: 13px 17px; border-radius: 16px; max-width: 80%;
  word-break: break-word;
}
.kidemo-msg.user {
  background: linear-gradient(180deg, var(--lime), #a6d72b);
  color: var(--bg); border-bottom-right-radius: 5px; font-weight: 600;
  box-shadow: 0 8px 22px -10px rgba(184,232,52,0.6);
}
.kidemo-msg.bot {
  background: var(--bg-elev); color: var(--cream);
  border: 1px solid var(--line); border-bottom-left-radius: 5px;
}
.kidemo-msg.bot.is-error { border-color: rgba(232,93,79,0.4); }

/* Markdown im Bot-Text */
.kidemo-msg.bot p { margin: 0 0 10px; }
.kidemo-msg.bot p:last-child { margin-bottom: 0; }
.kidemo-msg.bot strong { color: var(--lime); font-weight: 700; }
.kidemo-msg.bot em { font-style: italic; color: var(--cream); }
.kidemo-msg.bot ol, .kidemo-msg.bot ul { margin: 8px 0 12px; padding: 0; list-style: none; counter-reset: kd; }
.kidemo-msg.bot ol:last-child, .kidemo-msg.bot ul:last-child { margin-bottom: 0; }
.kidemo-msg.bot li { position: relative; padding-left: 30px; margin: 7px 0; line-height: 1.55; }
.kidemo-msg.bot ol li { counter-increment: kd; }
.kidemo-msg.bot ol li::before {
  content: counter(kd); position: absolute; left: 0; top: 1px;
  width: 21px; height: 21px; border-radius: 50%;
  background: var(--lime-glow); color: var(--lime);
  font-family: var(--body); font-weight: 700; font-size: 0.74rem;
  display: grid; place-items: center;
}
.kidemo-msg.bot ul li::before {
  content: ""; position: absolute; left: 7px; top: 9px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--lime);
}

/* Typing */
.kidemo-typing { display: inline-flex; gap: 5px; padding: 15px 17px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 16px; border-bottom-left-radius: 5px; }
.kidemo-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); opacity: .5; animation: kidemoType 1.2s infinite ease-in-out; }
.kidemo-typing span:nth-child(2){ animation-delay: .15s; }
.kidemo-typing span:nth-child(3){ animation-delay: .3s; }
@keyframes kidemoType { 0%,60%,100%{transform:translateY(0);opacity:.4} 30%{transform:translateY(-5px);opacity:1} }

/* ── Eingabe ────────────────────────────────────────────────── */
.kidemo-input-row {
  display: flex; gap: 10px; align-items: center;
  padding: clamp(14px, 3vw, 18px) clamp(18px, 3vw, 28px);
  border-top: 1px solid var(--line);
  background: linear-gradient(0deg, rgba(0,0,0,0.18), transparent);
}
.kidemo-input {
  flex: 1; min-width: 0;
  font-family: var(--body); font-size: 1rem; color: var(--cream);
  background: var(--bg); border: 1px solid var(--line-2);
  border-radius: 99px; padding: 14px 18px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.kidemo-input::placeholder { color: var(--muted); }
.kidemo-input:focus { border-color: var(--lime); box-shadow: 0 0 0 3px var(--lime-glow); }
.kidemo-send {
  flex: none; color: var(--bg);
  background: linear-gradient(180deg, var(--lime), #a6d72b); border: none;
  border-radius: 99px; width: 50px; height: 50px; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 10px 24px -10px rgba(184,232,52,0.7);
  transition: transform .12s ease, opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.kidemo-send:hover { transform: scale(1.07); }
.kidemo-send:active { transform: scale(0.97); }
.kidemo-send:disabled { opacity: .4; cursor: default; transform: none; box-shadow: none; }
.kidemo-send svg { width: 21px; height: 21px; }

.kidemo-foot {
  padding: 0 clamp(18px, 3vw, 28px) 18px;
  font-size: 0.8rem; color: var(--muted); text-align: center; line-height: 1.45;
}

@media (max-width: 520px) {
  .kidemo-msg { max-width: calc(100% - 46px); font-size: 0.94rem; }
  .kidemo-card { border-radius: 16px; }
  .kidemo-avatar { width: 30px; height: 30px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .kidemo-row, .kidemo-dot, .kidemo-typing span { animation: none !important; }
}
