@charset "UTF-8";

:root {
  interpolate-size: allow-keywords;
}

.ai-bubble-wrapper {
  position: fixed;
  bottom: 30px;
  left: 30px;
  z-index: var(--z-floating-ai, 120);
  font-family: Verdana, Geneva, sans-serif;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

.ai-bubble-wrapper.is-ready {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease, visibility 0s linear 0s;
}

.ai-bubble-wrapper.is-leaving {
  opacity: 0 !important;
  visibility: hidden !important;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  pointer-events: none !important;
}

.ai-bubble {
  pointer-events: auto;
  --bubble-size: 52px;
  --banner-max-width: 340px;
  width: max-content;
  max-width: var(--bubble-size);
  height: auto;
  min-height: var(--bubble-size);
  max-height: var(--bubble-size);
  background-color: #9f9f9f;
  border-radius: calc(var(--bubble-size) / 2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  z-index: 3;
  opacity: 1;
  transition: background-color 0.20s ease 0s, opacity 0.20s ease 0s;
  will-change: width, max-height, border-radius;
  contain: layout paint;
  transform: translateZ(0);
  /* Bereinigt: position und overflow waren hier doppelt */
  position: relative;
  overflow: hidden;
  transform-origin: left bottom;
}


.ai-bubble::after {
  content: "\2013\00a0\00a0\00a0 Zusammenfassung";
  font-family: 'Bison', sans-serif;
  letter-spacing: 1px;
  font-size: 20px;
  color: #fff;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  margin-right: 20px;
  display: none;
  position: relative;
  z-index: 2;
}


.ai-stars {
  opacity: 0.5 !important;
  position: absolute;
  inset: -25px;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, .55));
}

.ai-star {
  position: absolute;
  border-radius: 999px;
  background: #fff;
  transform: translate(-50%, -50%);
  will-change: left, top, opacity;
}

.ai-bubble>*:not(.ai-stars):not(.ai-stars-canvas):not(.close-bubble) {
  position: relative;
  z-index: 2;
	  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
}

.ai-stars-canvas {
  position: absolute;
  inset: -25px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.68;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.68));
}

/* --- ZUSTAND: GEÖFFNET --- */
.ai-bubble-wrapper.is-open .ai-bubble {
  width: 375px;
  max-width: 375px;
  max-height: 80vh;
  border-radius: 20px 20px 20px 5px;
  cursor: default;
  opacity: 1;
  transition:
    border-radius 0.2s ease 0s,
    width 0.3s ease-in-out 0s,
    max-width 0.3s ease-in-out 0s,
    max-height 0.55s cubic-bezier(.4, 0, .2, 1) 0.3s,
    background-color 0.20s ease 0s;
  display: flex;
  flex-direction: column;
}

.ai-bubble-wrapper.is-open .ai-bubble::after {
  display: none;
}

/* Hover: nur im geschlossenen Zustand */
.ai-bubble-wrapper:not(.is-open) .ai-bubble:hover {
  opacity: 0.75;
}

/* --- ZUSTAND: GESCHLOSSEN (vor Zusammenfassung) --- */
.ai-bubble-wrapper:not(.is-open):not(.has-summary) .ai-bubble {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  transition:
    max-width 0.3s ease,
    border-radius 0.2s ease,
    background-color 0.20s ease 0s,
    opacity 0.20s ease 0s;
}

.ai-bubble-wrapper:not(.is-open):not(.has-summary) .ai-bubble::after {
  display: inline-flex;
}

.ai-bubble-wrapper.has-intro:not(.is-open):not(.has-summary) .ai-bubble {
  animation: introBubble 4.5s ease-in-out;
}

.ai-bubble-wrapper.has-intro:not(.is-open):not(.has-summary) .ai-bubble::after {
  animation: introBannerText 4.5s ease-in-out;
}

.ai-bubble-wrapper:not(.is-open):not(.has-summary):hover .ai-bubble {
  max-width: var(--banner-max-width);
}

.ai-bubble-wrapper:not(.is-open):not(.has-summary):hover .ai-bubble::after {
  opacity: 0.75;
  transform: translateX(0);
}

/* --- ZUSTAND: GESCHLOSSEN (Übergang zurück nach Zusammenfassung) --- */
.ai-bubble-wrapper.has-summary:not(.is-open) .ai-bubble {
  width: var(--bubble-size);
  max-width: var(--bubble-size);
  transition:
    max-height 0.55s cubic-bezier(.4, 0, .2, 1) 0s,
    width 0.30s ease-in-out 0.55s,
    max-width 0.30s ease-in-out 0.55s,
    border-radius 0.20s ease 0.55s,
    background-color 0.20s ease 0s;
}

.ai-bubble-wrapper.has-summary .ai-bubble::after {
  display: none;
}

/* --- ICON STYLING --- */

/* Icon: Basis-Definition (Startzustand / Versteckt wenn offen) */
.ai-bubble-icon {
  height: 0;
  max-height: 0;
  min-height: 0;
  width: var(--bubble-size);
  flex-shrink: 0;
  display: flex;
  font-family: 'Bison', sans-serif;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition:
    opacity 0.15s ease 0s,
    max-height 0.2s ease 0s;
}

/* Icon im offenen Zustand aus dem Grid-Flow nehmen (verhindert Leerraum oben) */
.ai-bubble-wrapper.is-open .ai-bubble-icon {
  display: none;
}

/* Icon: Sichtbar (wenn Blase zu ist) */
/* HIER WAREN DIE DOPPELTEN EINTRÄGE - jetzt zusammengeführt */
.ai-bubble-wrapper:not(.is-open) .ai-bubble-icon {
  height: var(--bubble-size);
  max-height: var(--bubble-size);
  min-height: var(--bubble-size);
  opacity: 1;
  pointer-events: auto;
  transition:
    max-height 0s linear 0.55s,
    min-height 0s linear 0.55s,
    /* Wichtig gegen das Hüpfen */
    opacity 0.2s ease 0.75s;
}

/* Im final geschlossenen Summary-State soll KI schneller sichtbar werden */
.ai-bubble-wrapper.has-summary:not(.is-open):not(.is-closing) .ai-bubble-icon {
  transition:
    max-height 0s linear 0.12s,
    min-height 0s linear 0.12s,
    opacity 0.14s ease 0.12s;
}

/* Beim Schließen kein KI-Label einblenden */
.ai-bubble-wrapper.is-closing .ai-bubble-icon {
  opacity: 0 !important;
  max-height: 0 !important;
  min-height: 0 !important;
  pointer-events: none !important;
}

/* Beim Schließen keine Opacity-Änderung zulassen (kein kurzes Ausgrauen) */
.ai-bubble-wrapper.is-closing .ai-bubble,
.ai-bubble-wrapper.is-closing .ai-bubble:hover {
  opacity: 1 !important;
}

/* --- INHALT BOX (TEXT & BUTTONS) --- */
.ki-box {
  opacity: 0;
  padding: 20px 30px 20px 20px;
  color: #fff;
  width: 100%;
  box-sizing: border-box;
  pointer-events: none;
  transform: translateY(8px);
  filter: blur(2px);
  will-change: transform, opacity, filter;
  transition:
    opacity 0.35s ease 0s,
    transform 0.45s cubic-bezier(.2, .8, .2, 1) 0s,
    filter 0.45s ease 0s;
  display: block;
  overflow: hidden;
}

.ai-bubble-wrapper.is-open .ki-box {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  filter: blur(0);
  transition-delay: 0.20s;
}

.ai-bubble-wrapper:not(.is-open):not(.is-closing) .ki-box {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  filter: blur(2px);
  position: absolute;
  padding: 0;
  margin: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  transition:
    opacity 0.12s linear 0s,
    transform 0.25s cubic-bezier(.4, 0, .2, 1) 0s,
    filter 0.25s ease 0s;
}

#ki-text {
  font-size: 0.9rem !important;
  margin-top: 10px !important;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(6px);
  color: #fff;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
	
  transition:
    opacity 0.45s ease 0s,
    transform 0.45s cubic-bezier(.2, .8, .2, 1) 0s,
    color 0.4s ease;
}

#ki-text .ki-text-committed,
#ki-text .ki-text-live {
  white-space: pre-wrap;
	  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
}

#ki-text .ki-text-live {
  display: inline;
  vertical-align: baseline;
  will-change: filter, opacity;
}

#ki-text .ki-text-live.is-blur {
  animation: kiTextBlurIn 0.32s ease;
}

#ki-text.is-reveal {
  animation: kiTextReveal 0.35s ease both;
}

.ai-bubble-wrapper.is-open #ki-text {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.28s;
}

#aiContainer.is-loading #ki-text {
  color: #ccc !important;
}

.ki-headline {
  font-family: 'Bison', sans-serif;
  font-size: 1.5rem;
  margin-bottom: 5px;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.45s ease 0s,
    transform 0.45s cubic-bezier(.2, .8, .2, 1) 0s;
}

.ai-bubble-wrapper.is-open .ki-headline {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.22s;
}

/* --- ACTIONS (BUTTONS) --- */
.ki-actions {
  margin-top: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition:
    max-height 0.4s ease-in-out,
    opacity 0.25s ease-in-out,
    margin-top 0.25s ease-in-out;
}

.ki-actions.is-visible {
  max-height: 200px;
  opacity: 1;
  margin-top: 15px;
  pointer-events: auto;
}

.ai-bubble-wrapper:not(.is-open):not(.is-closing) .ki-actions {
  max-height: 0 !important;
  opacity: 0 !important;
  margin-top: 0 !important;
  pointer-events: none;
  transition:
    max-height 0.20s ease 0.55s,
    opacity 0.15s ease 0.55s,
    margin-top 0.20s ease 0.55s;
}

.ki-badget {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  padding: 3px 11px 4px 11px;
  border-radius: 50px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Bison', sans-serif;
}

.ki-badget:hover {
  background: #fff;
  color: #9f9f9f;
}

.close-bubble {
  position: absolute;
  top: 10px;
  right: 15px;
  color: #fff;
  cursor: pointer;
  font-size: 1.2rem;
  display: none;
  opacity: 0.5;
  transition: 0.2s;
}

/* sicherstellen, dass die absolute Position nicht vom generischen Child-Rule überschrieben wird */
.ai-bubble>.close-bubble {
  position: absolute;
  z-index: 3;
}

.close-bubble:hover {
  opacity: 1;
}

.ai-bubble-wrapper.is-open .close-bubble {
  display: block;
}

/* --- BUBBLE-BANNER MIT START-ANIMATION & HOVER --- */
@keyframes introBubble {
  0% {
    max-width: var(--bubble-size);
  }

  15%,
  85% {
    max-width: var(--banner-max-width);
  }

  100% {
    max-width: var(--bubble-size);
  }
}

@keyframes introBannerText {
  0% {
    opacity: 0;
    transform: translateX(-10px);
  }

  15%,
  85% {
    opacity: 0.75;
    transform: translateX(0);
  }

  100% {
    opacity: 0;
    transform: translateX(-10px);
  }
}

@keyframes kiTextReveal {
  from {
    opacity: 0;
    transform: translateY(6px);
    filter: blur(2px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes kiTextBlurIn {
  from {
    opacity: 0.65;
    filter: blur(2.5px);
  }

  to {
    opacity: 1;
    filter: blur(0);
  }
}

body.locked .ai-bubble-wrapper {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s !important;
}

body:not(.locked) .ai-bubble-wrapper.is-ready {
  transition: opacity 0.4s ease, visibility 0s linear 0s !important;
}

/* Touch-Geräte: Hover-Zustände dürfen nicht "kleben" bleiben */
@media (hover: none),
(pointer: coarse) {

  .ai-bubble-wrapper:not(.is-open) .ai-bubble,
  .ai-bubble-wrapper:not(.is-open) .ai-bubble:hover {
    opacity: 1;
  }

  .ai-bubble-wrapper:not(.is-open):not(.has-summary):hover .ai-bubble {
    max-width: var(--bubble-size);
  }

  .ai-bubble-wrapper:not(.is-open):not(.has-summary):hover .ai-bubble::after {
    opacity: 0;
    transform: translateX(-10px);
  }
}

@media (max-width: 768px) {
  .ai-bubble-wrapper {
    left: 10px !important;
    bottom: 20px;
  }

  .ai-bubble-wrapper.is-open .ai-bubble {
    width: 94.5vw;
    max-width: 94.5vw;
  }

  #ki-text {
    font-size: 0.8rem !important;
  }

  .ki-badget {
    padding: 2px 9px 3px 9px;
    font-size: 1rem;
  }
}
