/* ===================================================================
   askai.css — Futuristic Animated AI Chat Interface
   Combines glassmorphism, neon-glow, subtle motion and micro-interactions
   =================================================================== */

/* 1. Root Variables */
:root {
  /* Core Palette */
  --clr-bg-start: #0a0a23;
  --clr-bg-end:   #020220;
  --clr-glass:    rgba(255,255,255,0.03);
  --clr-border:   rgba(255,255,255,0.15);

  --clr-user-bg:  rgba(128, 0, 255, 0.6);
  --clr-user-bd:  rgba(180, 100, 255, 0.7);
  --clr-user-tx:  #ffffff;

  --clr-ai-bg:    rgba(0, 200, 255, 0.5);
  --clr-ai-bd:    rgba(0, 200, 255, 0.7);
  --clr-ai-tx:    #102e3b;

  --clr-scroll:     rgba(0,200,255,0.6);
  --clr-scroll-bg:  rgba(255,255,255,0.02);

  --font-main:    'Iceland', monospace;
}

/* 2. Global Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 20% 20%, var(--clr-bg-start), var(--clr-bg-end));
  background-size: 200% 200%;
  animation: bgShift 30s linear infinite;
  font-family: var(--font-main);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-ai-tx);
}

/* 3. Background Gradient Animation */
@keyframes bgShift {
  0%   { background-position:   0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position:   0% 50%; }
}

/* 4. Main Container (Glass Card) */
.link-block {
  position: relative;
  width: 75vw;
  max-width: 900px;
  height: 75vh;
  max-height: 650px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: var(--clr-glass);
  border: 2px solid var(--clr-border);
  border-radius: 24px;
  backdrop-filter: blur(16px) saturate(1.2);
  padding: 2rem;
  overflow: hidden;
  opacity: 0;
  transform: translateY(50px) scale(0.96) skewY(3deg);
  transition: transform 0.8s cubic-bezier(0.25,1,0.5,1),
              opacity   0.6s ease;
  box-shadow:
    0 0 20px rgba(0,200,255,0.2),
    0 0 40px rgba(160, 32,240,0.2);
}

/* 5. Swirling Accent Behind Glass */
.link-block::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 90deg at 50% 50%,
    rgba(60,0,255,0.3),
    transparent 70%,
    rgba(0,200,255,0.3),
    transparent 90%
  );
  animation: swirl 20s linear infinite;
  z-index: -1;
}
@keyframes swirl {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.link-block.reveal {
  opacity: 1;
  transform: translateY(0) scale(1) skewY(0);
}

/* 6. Section Title with Neon-Pulse */
.section-title {
  font-size: 2.4rem;
  text-align: center;
  color: #e0fbfc;
  letter-spacing: 2px;
  margin-bottom: 1rem;
  text-shadow:
    0 0 8px rgba(0,200,255,0.7),
    0 0 16px rgba(160, 32,240,0.5);
  user-select: none;
  animation: titleGlow 4s ease-in-out infinite alternate;
}
@keyframes titleGlow {
  from {
    text-shadow:
      0 0 6px rgba(0,200,255,0.5),
      0 0 12px rgba(160, 32,240,0.4);
  }
  to {
    text-shadow:
      0 0 12px rgba(0,200,255,0.9),
      0 0 24px rgba(160, 32,240,0.7);
  }
}

/* 7. Chat Container & Scroll */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 1rem;
  overflow-y: auto;
  background: rgba(20, 5,60,0.3);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 16px;
  min-height: 0; /* enables proper flex behavior */
}
.chat-container::-webkit-scrollbar {
  width: 8px;
}
.chat-container::-webkit-scrollbar-track {
  background: var(--clr-scroll-bg);
  border-radius: 4px;
}
.chat-container::-webkit-scrollbar-thumb {
  background: var(--clr-scroll);
  border-radius: 4px;
}

/* 8. Chat Bubbles with Entrance & Hover Animations */
.bubble {
  position: relative;
  max-width: 70%;
  padding: 12px 16px;
  font-size: 1rem;
  line-height: 1.4;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  word-wrap: break-word;
  user-select: text;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  animation: bubbleFade 0.5s forwards ease-out;
}
.bubble:nth-child(odd) {
  animation-delay: 0.1s;
}
.bubble:nth-child(even) {
  animation-delay: 0.2s;
}
@keyframes bubbleFade {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.bubble:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

/* User Bubble */
.bubble.user {
  align-self: flex-end;
  background: var(--clr-user-bg);
  border: 1px solid var(--clr-user-bd);
  color: var(--clr-user-tx);
}
.bubble.user::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: -8px;
  border-top: 8px solid var(--clr-user-bg);
  border-left: 8px solid transparent;
}

/* AI Bubble */
.bubble.ai {
  align-self: flex-start;
  background: var(--clr-ai-bg);
  border: 1px solid var(--clr-ai-bd);
  color: var(--clr-ai-tx);
}
.bubble.ai::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -8px;
  border-top: 8px solid var(--clr-ai-bg);
  border-right: 8px solid transparent;
}

/* 9. Message Input with Pulse & Glow */
#messageInput {
  margin-top: 1rem;
  padding: 12px 16px;
  font-size: 1rem;
  border: none;
  border-radius: 24px;
  background: rgba(255,255,255,0.04);
  color: #eef2ff;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.4);
  outline: none;
  transition: background 0.4s ease, box-shadow 0.2s ease;
}
#messageInput:focus {
  background: rgba(255,255,255,0.08);
  animation: inputPulse 2s infinite ease-in-out;
}
@keyframes inputPulse {
  0%   { box-shadow: inset 0 0 12px rgba(0,200,255,0.7); }
  50%  { box-shadow: inset 0 0 8px rgba(0,200,255,0.4); }
  100% { box-shadow: inset 0 0 12px rgba(0,200,255,0.7); }
}
#messageInput::placeholder {
  color: rgba(255,255,255,0.6);
  animation: placeholderFlicker 3s infinite;
}
@keyframes placeholderFlicker {
  0%,100% { opacity: 0.6; }
  50%     { opacity: 0.3; }
}

.bubble.user, .bubble.ai {
  position: relative;
  overflow: visible;
}
.bubble.user::after, .bubble.ai::after {
  content: "";
  position: absolute;
  bottom: -6px;  /* direkt unter der Bubble */
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 8px;
  border-radius: 4px;
  background: currentColor;
  filter: blur(6px);
  opacity: 0.4;
  transition: opacity 0.3s ease, height 0.3s ease;
}
.bubble.user:hover::after, .bubble.ai:hover::after {
  opacity: 0.7;
  height: 12px;
}

.link-block {
  border: 2px solid rgba(0,200,255,0.6);
  box-shadow: 0 0 20px rgba(0,200,255,0.4);
  animation: neonBorder 3s ease-in-out infinite alternate;
}
@keyframes neonBorder {
  from { border-color: rgba(0,200,255,0.4); box-shadow: 0 0 10px rgba(0,200,255,0.3); }
  to   { border-color: rgba(160,32,240,0.6); box-shadow: 0 0 24px rgba(160,32,240,0.5); }
}

body::before {
  content: "";
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, #fff 1px, transparent 1px),
    radial-gradient(circle, #fff 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 50px 50px;
  animation: starTwinkle 6s linear infinite;
  opacity: 0.4;
}
@keyframes starTwinkle {
  0%,100% { background-position:   0 0, 50px 50px; opacity: 0.3; }
  50%      { background-position: 100px 100px, 150px 150px; opacity: 0.6; }
}

.typing {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  height: 24px;
  align-items: center;
}
.typing span {
  display: block; width: 8px; height: 8px;
  background: rgba(0,200,255,0.6);
  border-radius: 50%;
  animation: dotPulse 1s infinite ease-in-out both;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%,100% { transform: scale(1); opacity: 0.6; }
  50%     { transform: scale(1.6); opacity: 1; }
}

@keyframes msgGlitch {
  0%   { opacity: 1; transform: translate(0,0); filter: none; }
  20%  { transform: translate(-2px,2px); filter: hue-rotate(10deg); }
  40%  { transform: translate(2px,-2px); filter: hue-rotate(-10deg); }
  60%  { transform: translate(-2px,-2px); filter: hue-rotate(5deg); }
  80%  { transform: translate(2px,2px); filter: hue-rotate(-5deg); }
  100% { opacity: 1; transform: translate(0,0); filter: none; }
}
.bubble.ai {
  animation: msgGlitch 0.6s linear both;
}

/* ─── 1. Dreiecke komplett ausknipsen ───────────────────────────── */
.bubble.user::after,
.bubble.ai::after {
  content: none !important;
}

/* ─── 2. Glühender Lichtkranz unter jeder Bubble ──────────────── */
.bubble.user::before,
.bubble.ai::before {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  height: 6px;
  border-radius: 3px;
  background: currentColor;
  filter: blur(8px);
  opacity: 0.3;
  transition: opacity 0.3s ease, width 0.3s ease;
}
.bubble.user:hover::before,
.bubble.ai:hover::before {
  opacity: 0.6;
  width: 70%;
}

/* ─── 3. Neuer, lebendiger Hintergrund ─────────────────────────── */

/* 3a) Basis-Gradient */
body {
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  position: relative;
  overflow: hidden;
}

/* 3b) Sternenfeld mit zufälligen Partikeln */
body::before {
  content: "";
  position: absolute; top: 0; left: 0;
  width: 200%; height: 200%;
  background: transparent;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.6) 1px, transparent 1px),
    radial-gradient(circle, rgba(255,255,255,0.3) 2px, transparent 2px);
  background-size: 3px 3px, 7px 7px;
  animation: starfield 60s linear infinite;
  opacity: 0.4;
  z-index: 0;
}
@keyframes starfield {
  0%   { background-position:   0  0,   0   0; }
  100% { background-position: 100px 100px, 200px 200px; }
}

/* 3c) Sanfte Licht-Nebelschwaden */
body::after {
  content: "";
  position: absolute; top: -20%; left: -20%;
  width: 140%; height: 140%;
  background: radial-gradient(circle at 30% 30%, rgba(160,32,240,0.15), transparent 60%),
              radial-gradient(circle at 70% 80%, rgba(0,200,255,0.12), transparent 50%);
  filter: blur(80px);
  animation: nebula 30s ease-in-out infinite alternate;
  z-index: 0;
}
@keyframes nebula {
  from { transform: scale(1) translate(0,0) rotate(0deg); }
  to   { transform: scale(1.1) translate(-10%,10%) rotate(45deg); }
}

/* ─── 4. Glas-Block & Chat über dem Effekt ─────────────────────── */
.link-block {
  position: relative;
  z-index: 1;
}

/* ─── 1. Alte Pseudo-Elemente ausknipsen ─────────────────────────── */
.link-block::before,
body::before,
body::after {
  content: none !important;
  display: none !important;
}

/* ─── 2. Neuer, lebendiger Hintergrund ─────────────────────────── */

/* 2a) Basis: sanfter, fließender Gradient */
body {
  background: linear-gradient(120deg, #1a0142, #0f1548, #001f54);
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
}

/* Animation für den Farbwechsel */
@keyframes gradientShift {
  0%   { background-position:   0%  0%; }
  50%  { background-position: 100% 100%; }
  100% { background-position:   0%  0%; }
}

/* 2b) Overlay: feines, driftendes Raster */
body::after {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  mix-blend-mode: overlay;
  animation: gridDrift 30s linear infinite;
}

/* Animation für das langsam wandernde Raster */
@keyframes gridDrift {
  0%   { background-position:   0   0,    0   0; }
  50%  { background-position: 100px 100px, 0 100px; }
  100% { background-position:   0   0,  100px   0; }
}

/* ─── 3. Sanfte Partikel-Dots im Hintergrund ───────────────────── */

/* Erzeugt ein Feld leichter „Sterne“ über box-shadow */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  background: transparent;
  box-shadow:
    /* viele Punkt-Streifen erzeugen */
    10px 20px #fff2, 80px 50px #fff3, 140px 120px #fff1,
    200px 30px #fff2, 260px 180px #fff3, 320px 90px #fff1,
    380px 200px #fff2, 440px 70px #fff3, 500px 150px #fff1;
  animation: starDrift 40s linear infinite;
  opacity: 0.3;
}

/* Verschiebt die Partikel langsam über den Bildschirm */
@keyframes starDrift {
  to { transform: translate(-100px, -200px); }
}

/* ─── 4. Chat-Container & Bubbles oben halten ───────────────────── */
.link-block {
  position: relative;
  z-index: 1;
}
.chat-container {
  position: relative;
  z-index: 1;
}

/* ─── 1. Beweglicher „Spotlight“ im Hintergrund ───────────────── */
html::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  background: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.08), transparent 70%);
  background-size: 200% 200%;
  animation: roamSpot 12s ease-in-out infinite;
  z-index: 0;
}
@keyframes roamSpot {
  0%   { background-position: 0%   0%; }
  25%  { background-position: 80%  20%; }
  50%  { background-position: 100% 100%; }
  75%  { background-position: 20%  80%; }
  100% { background-position: 0%   0%; }
}

/* ─── 2. Subtiles „Kamerarauschen“ als Overlay ────────────────── */
html::after {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.02), rgba(255,255,255,0.02) 1px, transparent 1px, transparent 2px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.02), rgba(255,255,255,0.02) 1px, transparent 1px, transparent 2px);
  background-size: 4px 4px;
  opacity: 0.3;
  animation: noiseJitter 0.2s infinite steps(2);
  z-index: 0;
}
@keyframes noiseJitter {
  0%   { transform: translate(0,0); }
  50%  { transform: translate(1px,-1px); }
  100% { transform: translate(0,0); }
}

/* ─── 3. Scanning-Linie über dem Glas-Container ─────────────── */
.link-block::after {
  content: "";
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.06) 50%,
    transparent 100%
  );
  pointer-events: none;
  animation: scanLine 3.5s infinite ease-in-out;
  z-index: 2;
}
@keyframes scanLine {
  0%   { left: -100%; }
  50%  { left: 100%; }
  100% { left: -100%; }
}

/* ─── 4. Subtiler „Glitch“-Effekt auf dem Container ───────────── */
@keyframes containerGlitch {
  0%,100% { transform: none; clip-path: inset(0); }
  10% { transform: skewX(1deg) skewY(1deg); clip-path: inset(5% 0 5% 0); }
  20% { transform: skewX(-1deg) skewY(-1deg); clip-path: inset(3% 0 3% 0); }
  30% { transform: none; clip-path: inset(0); }
  60% { transform: skewX(0.5deg) skewY(-0.5deg); clip-path: inset(2% 0 2% 0); }
}
.link-block {
  animation: containerGlitch 8s infinite;
}

/* ─── 5. Dynamisch pulsierender Neon-Rahmen ─────────────────── */
@keyframes neonPulse {
  0%   { box-shadow: 0 0 10px rgba(0,200,255,0.4), 0 0 20px rgba(160,32,240,0.3); }
  50%  { box-shadow: 0 0 20px rgba(0,200,255,0.6), 0 0 40px rgba(160,32,240,0.5); }
  100% { box-shadow: 0 0 10px rgba(0,200,255,0.4), 0 0 20px rgba(160,32,240,0.3); }
}
.link-block {
  border: 2px solid rgba(0,200,255,0.6);
  animation: neonPulse 4s ease-in-out infinite;
}

/* ─── 6. Partikel-Funken fliegen vorbei ──────────────────────── */
@keyframes spark {
  0%   { transform: translate(var(--xStart), var(--yStart)); opacity: 1; }
  100% { transform: translate(var(--xEnd), var(--yEnd)); opacity: 0; }
}
:root {
  --spark-color: rgba(255,255,255,0.8);
}
body > .spark {
  position: fixed;
  width: 4px; height: 4px;
  background: var(--spark-color);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

/* ─── Scan-Balken endgültig entfernen ──────────────────────────── */
/* setzt alles außer Inhalt zurück und blendet die Pseudo-Ebene aus */
.link-block::after {
  content: none !important;
  display: none  !important;
}

/* ─── Sparks richtig knallen lassen ────────────────────────────── */
/* erhöhe Größe, Farbe, Leuchteffekt und blend-Modus */
.spark {
  width: 8px;
  height: 8px;
  background: rgba(0, 255, 255, 0.9);
  box-shadow:
    0 0 12px rgba(0,255,255,0.7),
    0 0 20px rgba(0,255,255,0.5);
  border-radius: 50%;
  mix-blend-mode: screen;
  opacity: 1 !important;
}

/* Optional: Bei ganz vielen Sparks noch die Dauer etwas anpassen */
@keyframes spark {
  0%   { transform: translate(var(--xStart), var(--yStart)) scale(1.2); opacity: 1; }
  50%  { opacity: 0.8; }
  100% { transform: translate(var(--xEnd), var(--yEnd)) scale(0.8); opacity: 0; }
}

/* ─── Input-Wrapper & Send-Button ───────────────────────────── */
.input-wrapper {
  position: relative;
  width: 100%;
  margin-top: 1rem;
}

.send-button {
  display: none;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  background: var(--clr-user-bg);
  border: 1px solid var(--clr-user-bd);
  color: var(--clr-user-tx);
  transition: background 0.3s ease, transform 0.2s ease;
  z-index: 2;
  display: flex;
}

.send-button:hover {
  transform: translateY(-50%) scale(1.1);
}

.send-button.disabled {
  background: rgba(255,80,80,0.6);
  border-color: rgba(255,80,80,0.8);
  cursor: default;
  opacity: 0.6;
}

.input-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  margin-top: 1rem;
  gap: 8px; /* kleiner Abstand zwischen Feld und Button */
}

#messageInput {
  flex: 1; /* nimmt den gesamten restlichen Platz ein */
  min-width: 0; /* verhindert, dass der Button rausgeschoben wird */
}

.send-button {
  flex: 0 0 auto; /* nur so breit wie nötig */
  width: 36px;
  height: 36px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  background: var(--clr-user-bg);
  border: 1px solid var(--clr-user-bd);
  color: var(--clr-user-tx);
  transition: background 0.3s ease, transform 0.2s ease;
  display: none; /* erscheint nur, wenn nötig */
}

.send-button:hover {
  transform: scale(1.1);
}

.send-button.disabled {
  background: rgba(255,80,80,0.6);
  border-color: rgba(255,80,80,0.8);
  cursor: default;
  opacity: 0.6;
}

.input-wrapper {
  display: flex;
  align-items: center; /* sorgt dafür, dass Pfeil und Textfeld auf einer Linie sind */
  width: 100%;
  margin-top: 1rem;
  gap: 6px; /* kleiner Abstand zwischen Feld und Button */
}

#messageInput {
  flex: 1; /* nimmt den gesamten restlichen Platz ein */
  min-width: 0; /* verhindert Überlappen */
  height: 40px; /* gleiche Höhe wie der Button */
  line-height: 40px;
  padding-right: 0.5rem; /* etwas Abstand zum Text */
}

.send-button {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  background: var(--clr-user-bg);
  border: 1px solid var(--clr-user-bd);
  color: var(--clr-user-tx);
  transition: background 0.3s ease, transform 0.2s ease;
  display: none; /* erscheint nur, wenn nötig */
}

.send-button:hover {
  transform: scale(1.1);
}

.send-button.disabled {
  background: rgba(255,80,80,0.6);
  border-color: rgba(255,80,80,0.8);
  cursor: default;
  opacity: 0.6;
}

.input-wrapper {
  display: flex;
  align-items: center; /* vertikal mittig */
  width: 100%;
  margin-top: 1rem;
}

#messageInput {
  flex: 1 1 auto;       /* wächst und schrumpft dynamisch */
  min-width: 0;         /* verhindert Überlappen */
  height: 40px;
  line-height: 40px;
  padding: 0 0.75rem;   /* gleichmäßiger Innenabstand */
  box-sizing: border-box;
}

.send-button {
  display: flex;        /* Inhalt (Pfeil) zentrieren */
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;       /* feste Breite/Höhe */
  height: 40px;
  margin-left: 6px;     /* Abstand zum Input */
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  background: var(--clr-user-bg);
  border: 1px solid var(--clr-user-bd);
  color: var(--clr-user-tx);
  transition: background 0.3s ease, transform 0.2s ease;
}

.send-button:hover {
  transform: scale(1.1);
}

.send-button.disabled {
  background: rgba(255,80,80,0.6);
  border-color: rgba(255,80,80,0.8);
  cursor: default;
  opacity: 0.6;
}

.input-wrapper {
  position: relative;
  width: 100%;
  margin-top: 1rem;
}

#messageInput {
  width: 100%;
  height: 40px;
  line-height: 40px;
  padding: 0 0.75rem;
  box-sizing: border-box;
  transition: padding-right 0.3s ease; /* sanftes Gleiten */
}

/* Wenn der Button sichtbar ist, bekommt das Feld mehr rechten Innenabstand */
.input-wrapper.show-button #messageInput {
  padding-right: 50px; /* Platz für den Button */
}

.send-button {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: none; /* Standard: unsichtbar */
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  background: var(--clr-user-bg);
  border: 1px solid var(--clr-user-bd);
  color: var(--clr-user-tx);
  transition: background 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
}

.send-button:hover {
  transform: translateY(-50%) scale(1.1);
}

.send-button.disabled {
  background: rgba(255,80,80,0.6);
  border-color: rgba(255,80,80,0.8);
  cursor: default;
  opacity: 0.6;
}

/* Input wrapper + slide space when button is visible */
.input-wrapper {
  position: relative;
  width: 100%;
  margin-top: 1rem;
}

#messageInput {
  width: 100%;
  height: 40px;
  line-height: 40px;
  padding: 0 0.75rem;
  box-sizing: border-box;
  transition: padding-right 0.3s ease;
}

.input-wrapper.show-button #messageInput {
  padding-right: 56px; /* makes the field slide left to make room */
}

/* Send button positioned over the right edge, no overlap thanks to padding-right */
.send-button {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  background: var(--clr-user-bg);
  border: 1px solid var(--clr-user-bd);
  color: var(--clr-user-tx);
  transition: background 0.25s ease, transform 0.2s ease, opacity 0.2s ease;
  z-index: 2;
}

/* If the button accidentally inherits bubble styles from elsewhere, neutralize them */
.send-button {
  opacity: 1 !important;
  transform: translateY(-50%) !important;
  animation: none !important;
  backdrop-filter: none !important;
  box-shadow: none;
}

/* Hover and disabled states */
.send-button:hover { transform: translateY(-50%) scale(1.1) !important; }
.send-button.disabled {
  background: rgba(255,80,80,0.6);
  border-color: rgba(255,80,80,0.8);
  cursor: default;
  opacity: 0.7;
}

/* Only show the button when there’s text AND sending is allowed */
.input-wrapper.show-button .send-button { display: flex; }

/* Der Wrapper kontrolliert den Zustand (Button sichtbar = mehr Platz rechts) */
.input-wrapper {
  position: relative;
  width: 100%;
  margin-top: 1rem;
}

/* Textbalken füllt immer maximal, macht rechts Platz wenn Button da ist */
#messageInput {
  width: 100%;
  height: 40px;
  line-height: 40px;
  padding: 0 0.75rem;
  box-sizing: border-box;
  transition: margin-right 220ms ease; /* sanftes „nach links gehen“ */
}

/* Wenn Button sichtbar ist: Platz rechts freiräumen (Buttonbreite + Abstand) */
.input-wrapper.show-button #messageInput {
  margin-right: 52px !important; /* 40px Button + 12px Abstand */
}

/* Sendepfeil: absolut rechts, vertikal zentriert, überlappt nie den Textbalken */
.send-button {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: none;           /* erscheint nur bei Text */
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  background: var(--clr-user-bg);
  border: 1px solid var(--clr-user-bd);
  color: var(--clr-user-tx);
  transition: background 0.25s ease, transform 0.2s ease, opacity 0.2s ease;
  z-index: 2;              /* sicher über allem */
}

/* Falls du zuvor .bubble auf dem Button hattest → neutralisieren */
.send-button {
  animation: none !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
  box-shadow: none;
}

.send-button:hover { transform: translateY(-50%) scale(1.1); }

.send-button.disabled {
  background: rgba(255,80,80,0.6);
  border-color: rgba(255,80,80,0.8);
  cursor: default;
  opacity: 0.7;
}

/* Button nur zeigen, wenn Wrapper im „show-button“-State ist */
.input-wrapper.show-button .send-button { display: flex; }

/* Position: arrow slightly lower than input center */
.send-button {
  top: calc(50% + 6px);              /* a bit lower */
  transform: translateY(-50%);       /* keep vertical alignment logic */
}

/* Smooth slide-in when the button appears */
.input-wrapper.show-button .send-button {
  animation: btnIn 220ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
@keyframes btnIn {
  0%   { opacity: 0; transform: translateY(-50%) translateX(8px) scale(0.9); }
  100% { opacity: 1; transform: translateY(-50%) translateX(0)   scale(1);   }
}

/* Gentle idle pulse for the arrow to feel alive */
.send-button:not(.disabled) {
  box-shadow: 0 0 0 rgba(0,0,0,0);
  animation: btnPulse 2.2s ease-in-out infinite 320ms;
}
@keyframes btnPulse {
  0%,100% { box-shadow: 0 0 0 rgba(0,200,255,0); transform: translateY(-50%) scale(1); }
  50%     { box-shadow: 0 0 14px rgba(0,200,255,0.35); transform: translateY(-50%) scale(1.05); }
}

/* Ripple on click */
.send-button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.5), transparent 60%);
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}
.send-button.press::after {
  animation: ripple 380ms ease-out;
}
@keyframes ripple {
  0%   { transform: scale(0);   opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0;   }
}

/* Morph feedback when sending (disabled state) */
.send-button.disabled {
  background: rgba(255,80,80,0.65);
  border-color: rgba(255,110,110,0.9);
  animation: warnFlash 520ms ease-out 1;
}
@keyframes warnFlash {
  0%   { box-shadow: 0 0 0 rgba(255,80,80,0);   transform: translateY(-50%) scale(1);   }
  30%  { box-shadow: 0 0 20px rgba(255,80,80,0.55); transform: translateY(-50%) scale(1.08); }
  100% { box-shadow: 0 0 10px rgba(255,80,80,0.25); transform: translateY(-50%) scale(1.02); }
}

/* Input slide space is already handled; make the slide a bit smoother */
#messageInput {
  transition: margin-right 220ms ease, box-shadow 220ms ease;
}
#messageInput:focus {
  box-shadow: 0 0 0 0 rgba(0,200,255,0);
  animation: inputGlow 1.8s ease-in-out infinite;
}
@keyframes inputGlow {
  0%,100% { box-shadow: inset 0 0 10px rgba(0,200,255,0.25); }
  50%     { box-shadow: inset 0 0 16px rgba(0,200,255,0.45); }
}

.spark {
  position: absolute;
  width: 2px;
  height: 2px;
  background: orange;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

@keyframes spark {
  from {
    transform: translate(var(--xStart), var(--yStart));
    opacity: 1;
  }
  to {
    transform: translate(var(--xEnd), var(--yEnd));
    opacity: 0;
  }
}

.spark {
  position: fixed;
  width: 2px;
  height: 2px;
  background: orange;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform, opacity;
}

@keyframes spark {
  to {
    transform: translate(var(--dx), var(--dy));
    opacity: 0;
  }
}

.spark {
  background: radial-gradient(circle, yellow, orange);
  box-shadow: 0 0 4px orange;
}