/* 17-chat.css — Interaktiver Chat + Gamification-Slider
   Teil von css/living-canvas (aufgeteilt). Ladereihenfolge = Dateiname.
   Siehe docs/components/ fuer die Zuordnung Sektion -> Datei. */
.interactive-chat-section {
  min-height: 90vh;
  display: flex;
  align-items: center;
  padding: 80px clamp(24px, 6vw, 80px);
  position: relative;
  overflow: hidden;
  background-color: var(--paper);
}
.mesh-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.5;
  z-index: 0;
  animation: floatMesh 15s ease-in-out infinite alternate;
}
.mesh-teal {
  width: 600px;
  height: 600px;
  background: var(--lime);
  top: -100px;
  left: -200px;
}
.mesh-apricot {
  width: 500px;
  height: 500px;
  background: var(--apricot);
  bottom: -150px;
  right: -100px;
  animation-delay: -5s;
}
@keyframes floatMesh {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(100px, 50px) scale(1.1); }
  100% { transform: translate(-50px, 100px) scale(0.9); }
}
.chat-section-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 60px;
  align-items: center;
  max-width: 1120px;
  margin: 0 auto;
}
.chat-text-col {
  padding-right: 20px;
}
.chat-widget {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  box-shadow: 0 30px 60px rgba(16,43,60,0.06), 0 0 0 1px rgba(185,216,214,0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 480px;
  width: 100%;
}
/* Kurze Viewports (z. B. Tastatur eingeblendet auf einem kleinen Handy):
   feste 480px koennen dann Eingabefeld/Senden-Button aus dem sichtbaren
   Bereich draengen — hier stattdessen an der Viewport-Hoehe orientieren
   (Mobile-Audit, "Verdacht: .chat-widget"). */
@media (max-height: 700px) {
  .chat-widget {
    height: min(480px, 78vh);
  }
}
.chat-header {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(185,216,214,0.4);
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(16, 43, 60, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}
.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.chat-info {
  display: flex;
  flex-direction: column;
}
.chat-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
}
.chat-status-text {
  font-size: 12px;
  color: var(--grey);
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-dot {
  width: 8px;
  height: 8px;
  background: var(--lime);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--lime);
}
.chat-messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chat-msg {
  max-width: 85%;
  padding: 12px 18px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.45;
  animation: popIn 0.4s var(--ease-spring) forwards;
  transform-origin: bottom left;
}
@keyframes popIn {
  0% { opacity: 0; transform: scale(0.9) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.bot-msg {
  background: #fff;
  color: var(--ink);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  border: none;
  box-shadow: 0 4px 12px rgba(16,43,60,0.04);
}
.user-msg {
  /* Markenfarbe --teal, Nicos Entscheidung 25.09.2026 (weiss darauf 4.05:1). */
  background: var(--teal);
  color: #fff;
  font-weight: 400;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  transform-origin: bottom right;
  box-shadow: none;
}
.typing-bubble {
  background: #fff;
  padding: 12px 18px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  box-shadow: 0 4px 12px rgba(16,43,60,0.04);
}
.typing-bubble span {
  width: 6px;
  height: 6px;
  background: var(--grey);
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out both;
}
.typing-bubble span:nth-child(1) { animation-delay: -0.32s; }
.typing-bubble span:nth-child(2) { animation-delay: -0.16s; }
@keyframes typingDot {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
.chat-input-area {
  padding: 16px;
  background: #fff;
  border-top: 1px solid rgba(185,216,214,0.4);
  display: flex;
  gap: 12px;
  align-items: center;
}
#interactive-chat-input {
  flex: 1;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 14px 20px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: all 0.2s;
}
#interactive-chat-input::placeholder {
  color: var(--grey);
}
#interactive-chat-input:focus {
  border-color: var(--teal);
  background: var(--paper);
}
.chat-submit-btn {
  background: var(--teal);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
}
.chat-submit-btn:hover {
  transform: scale(1.08) rotate(-5deg);
  background: var(--teal-d);
  color: #fff;
}
.chat-submit-btn:disabled,
#interactive-chat-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.chat-msg.error-msg {
  background: #fff0ee;
  color: #9c2b1f;
  border: 1px solid rgba(220, 80, 60, 0.3);
}

/* Honeypot-Feld (Spam-Schutz) — fuer Menschen unsichtbar, aber nicht
   display:none/visibility:hidden, da einige Spam-Bots genau danach filtern. */
.hp-field {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Mechanischer Senden-Knopf (Stand 25.09.2026, ersetzt den Swipe-Slider).
   Gedrueckt halten statt klicken: der Ring fuellt sich in ~1.2 s, erst dann
   geht die Nachricht raus. Loslassen vorher = Ring laeuft zurueck. Bremst
   Formular-Bots (zusammen mit Honeypot + Mindestzeit in mail-handler.php)
   und ist per Maus, Touch und Tastatur (Leertaste/Enter halten) bedienbar.
   Logik: js/07-chat.js. */
.chat-send-area {
  padding: 18px 16px 20px;
  background: #fff;
  border-top: 1px solid rgba(185,216,214,0.4);
  display: flex;
  justify-content: center;
}
.chat-send-area[hidden] { display: none; }
.send-console {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 22px 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: inset 0 2px 6px rgba(16,43,60,0.06);
}
.send-knob {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.send-knob:focus-visible {
  outline: 3px solid var(--teal-d);
  outline-offset: 3px;
  border-radius: 50%;
}
.send-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.send-ring circle {
  fill: none;
  stroke-width: 4;
}
.send-ring .ring-bg { stroke: var(--line); }
.send-ring .ring-fill {
  stroke: var(--apricot);
  stroke-linecap: round;
  stroke-dasharray: 182.2;
  stroke-dashoffset: 182.2;
}
.send-cap {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #19a9b2 0%, var(--teal) 55%, #007a82 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  /* "Hub": sichtbare Unterkante, die beim Druecken verschwindet */
  box-shadow: 0 5px 0 var(--teal-d), 0 8px 14px rgba(16,43,60,0.18);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}
.send-knob.is-pressed .send-cap,
.send-knob.is-done .send-cap {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--teal-d), 0 2px 6px rgba(16,43,60,0.18);
}
.send-knob.is-done .send-cap {
  background: radial-gradient(circle at 35% 30%, #dff98f 0%, var(--lime) 60%, #a9d651 100%);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--lime-d), 0 2px 6px rgba(16,43,60,0.18);
}
.send-knob.is-done .ring-fill { stroke: var(--lime-d); }
.send-knob.is-done { cursor: default; }
.send-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.send-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.3px;
}
.send-sub {
  font-size: 12px;
  color: var(--grey);
  display: flex;
  align-items: center;
  gap: 6px;
}
.send-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.15);
  transition: background 0.2s, box-shadow 0.2s;
}
.send-console.is-charging .send-led {
  background: var(--apricot);
  box-shadow: 0 0 8px var(--apricot);
  animation: ledBlink 0.35s steps(2) infinite;
}
.send-console.is-done .send-led {
  background: var(--lime-d);
  box-shadow: 0 0 8px var(--lime);
  animation: none;
}
@keyframes ledBlink { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
  .send-cap { transition: none; }
  .send-console.is-charging .send-led { animation: none; }
}

.apple-style-bg .mesh-glow {
  opacity: 0.2;
  filter: blur(100px);
}

@media (max-width: 900px) {
  .chat-section-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .interactive-chat-section {
    padding: 60px clamp(24px, 6vw, 80px);
  }
}

/* Formular per hidden-Attribut ausblenden (js/07-chat.js), sonst gewinnt display:flex */
.chat-input-area[hidden] { display: none; }
