/* === Zylinder-Trigger-Button === */
#zylinderTrigger {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  cursor: pointer;
  z-index: 2147483647 !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
#zylinderTrigger img {
  width: 100%;
  height: auto;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(75, 155, 52, 0.4);
}
#zylinderTrigger img:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(75, 155, 52, 0.6);
}
#chatbotPopup.active ~ #zylinderTrigger {
  display: none;
}

/* === Chatbot-Popup === */
#chatbotPopup {
  position: fixed;
  top: 10vh;
  right: 0;
  width: 400px;
  max-width: 95vw;
  height: 80vh;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: -8px 8px 24px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  z-index: 2147483646;
  transform: translateX(100%);
  transition: transform 0.5s ease;
  font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
  color: #222;
  display: flex;
  flex-direction: column;
  border-top-left-radius: 28px;
  border-bottom-left-radius: 28px;
}
#chatbotPopup.active {
  transform: translateX(0);
}
#chatbotPopup.expand-left {
  width: 720px;
}

/* === Wrapper für Sidepanel + Chatbereich === */
.chatbot-wrapper {
  display: flex;
  flex-direction: row;
  height: 100%;
  width: 100%;
  min-height: 0;
}

/* === Seitenpanel === */
.zcb-sidepanel {
  display: none;
  width: 300px;
  background: rgba(255, 255, 255, 0.3);
  padding: 1rem;
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  overflow-y: auto;
  color: #222;
}
.chatbot-popup.expand-left .zcb-sidepanel {
  display: block;
}

/* === Dynamischer Content im Panel === */
#zcb-dynamic-content {
  display: none;
}
#zcb-dynamic-content * {
  max-width: 100%;
  box-sizing: border-box;
  word-break: break-word;
}
#chatbotPopup.expand-left #zcb-dynamic-content {
  display: block;
  background: rgba(255, 255, 255, 0.3);
  border-left: 2px solid #4b9b34;
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 16px;
  font-size: 0.95rem;
  color: #222;
  overflow-y: auto;
}

/* === Haupt-Chatbereich === */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* === Header === */
.chat-header {
  background: rgba(75, 155, 52, 0.95);
  color: white;
  padding: 1rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 1.1rem;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.2);
}
.popup-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.popup-close:hover {
  transform: scale(1.2);
}

/* === Nachrichtenverlauf === */
.chat-content {
  flex: 1;
  padding: 1rem 1.2rem;
  overflow-y: auto;
  background: transparent;
  color: #222;
  min-height: 0;
}
.message {
  max-width: 85%;
  margin-bottom: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 18px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
  line-height: 1.6;
}
.message.user {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(6px);
  margin-left: auto;
  text-align: right;
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.message.bot {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(6px);
  text-align: left;
}

/* === Denkpunkt (Animation) === */
.thinking-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 8px 2px;
  background: #4b9b34;
  border-radius: 50%;
  animation: pulsiere 1s infinite ease-in-out;
}
@keyframes pulsiere {
  0% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.5); opacity: 1; }
  100% { transform: scale(1); opacity: 0.4; }
}

/* === Eingabebereich === */
.chat-input {
  background: rgba(255, 255, 255, 0.3);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.chat-input textarea {
  flex: 1;
  resize: none;
  border: none;
  padding: 0.7rem 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.8);
  color: #222;
  font-size: 0.95rem;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}
.chat-input button {
  background: #4b9b34;
  color: white;
  border: none;
  padding: 0.65rem 1.2rem;
  font-weight: bold;
  font-size: 0.95rem;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}
.chat-input button:hover {
  background: #3c8c2f;
  transform: scale(1.05);
}

/* === Mobil-Optimierung === */
@media (max-width: 768px) {
  #chatbotPopup {
    width: 95vw !important;
    height: auto !important;
    top: 0;
    right: 0;
    margin: 0;
    border-radius: 0;
  }
  #chatbotPopup.expand-left {
    width: 95vw !important;
  }
  .chatbot-wrapper {
    flex-direction: column;
  }
  .zcb-sidepanel {
    width: 100% !important;
    display: block !important;
    order: -1;
    border: none;
    border-bottom: 1px solid #ccc;
  }
  #zcb-dynamic-content {
    display: block !important;
    margin: 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0;
    border-top: 1px solid #ccc;
  }
}

.zcb-sidepanel {
  position: relative; /* nötig für absolute Positionierung */
}

.zcb-close-button {
  position: absolute;
  top: 12px;
  right: 400px;
  background: none;
  border: none;
  color: #222;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  z-index: 10000000;
  transition: background 0.2s ease;
}

.zcb-close-button:hover {
  background: rgba(0, 0, 0, 0.05);
}
/* === Mobile: wie Desktop, ohne Sidepanel === */
@media (max-width: 768px) {
  /* Popup-Erscheinung wie Desktop behalten */
  #chatbotPopup {
    width: 95vw !important;   /* deine Breite bleibt */
    height: 80vh !important;  /* fix auf 80vh */
    top: 10vh !important;     /* wie Desktop */
    right: 0 !important;
    border-top-left-radius: 28px !important;
    border-bottom-left-radius: 28px !important;
  }

  /* Layout NICHT stapeln */
  .chatbot-wrapper {
    flex-direction: row !important;
  }

  /* Sidepanel komplett ausblenden */
  .zcb-sidepanel,
  #zcb-dynamic-content {
    display: none !important;
  }

  /* Hauptbereich korrekt flexen */
  .chat-main {
    height: 100% !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Nachrichtenbereich scrollen lassen */
  .chat-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch; /* sanftes Scrollen iOS */
  }

  /* Input bleibt sichtbar */
  .chat-input {
    flex: 0 0 auto !important;
  }
}

/* Sicherheitshalber auch außerhalb vom Media-Query: */
.chat-content {
  min-height: 0;            /* verhindert „no scroll“ in flex-Containern */
  overflow-y: auto;
}
