:root {
  --docbot-primary-800: #1e293b;
  --docbot-primary-500: #64748b;
  --docbot-primary-300: #cbd5e1;
  --docbot-primary-200: #e2e8f0;
  --docbot-secondary: #f1f5f9;
  font-family: "Poppins", sans-serif;
  font-size: 15px;
}

html,
body {
  position: relative;
  height: 100%;
  font-family: "Poppins", sans-serif;
  font-size: 15px;
}

#docbot-chat-container {
  font-family: "Poppins", sans-serif;
  position: fixed;
  z-index: 1000;
}

#docbot-chat-container #docbot-chat-bubble {
  position: fixed;
  bottom: 25px;
  right: 25px;
  cursor: pointer;
  background-color: var(--docbot-secondary);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
  z-index: 101;
}

#docbot-chat-container #docbot-chat-bubble svg {
  height: 35px;
  width: 35px;
}

#docbot-chat-container #docbot-chat-bubble:hover {
  transform: scale(1.1);
}

#docbot-chat-container #docbot-chat-bubble.open {
  background-color: transparent;
  box-shadow: none;
}

#docbot-chat-container #docbot-chat-bubble #docbot-chat-badge {
  position: absolute;
  top: -5px;
  left: -5px;
  background-color: red;
  color: white;
  font-size: 12px;
  width: 18px;
  height: 18px;
  text-align: center;
  line-height: 18px;
  border-radius: 50%;
  display: none;
  z-index: 102;
}

#docbot-chat-container #docbot-chat-window {
  display: none;
  position: fixed;
  bottom: 35px;
  right: 25px;
  width: 360px;
  height: 80%;
  min-height: 440px;
  max-height: 700px;
  box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px;
  border-radius: 16px;
  overflow: hidden;
  z-index: 100;
  flex-direction: column;
  animation: fadeIn 0.3s ease;
}

/* Einwilligungs-Overlay */
#docbot-consent-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255);
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 40% 40px 40px;
  text-align: center;
}

#docbot-consent-overlay h3 {
  color: var(--docbot-primary-800);
  margin-bottom: 7px;
  font-size: 18px;
}

#docbot-consent-overlay p {
  color: var(--docbot-primary-500);
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
}

#docbot-consent-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

#docbot-consent-accept,
#docbot-consent-decline {
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  font-family: "Poppins", sans-serif;
}

#docbot-consent-accept {
  position: relative;
  color: white;
  background: linear-gradient(135deg, #7b60fe, #49cdfd) padding-box,
    linear-gradient(135deg, #7b60fe, #49cdfd) border-box;
  border: 3px solid transparent;
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

#docbot-consent-accept:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  color: #000000;
  background: linear-gradient(white, white) padding-box,
    conic-gradient(
        from var(--docbot-gradient-angle, 0deg),
        #7b60feff,
        #49cdfdff,
        #3990fdff,
        #7b60feff
      )
      border-box;
  animation: docbot-gradient-rotate 2s linear infinite;
  background-origin: border-box;
  background-clip: padding-box, border-box;
  border: 3px solid transparent;
}

#docbot-consent-decline {
  background: var(--docbot-primary-200);
  color: var(--docbot-primary-800);
}

#docbot-consent-decline:hover {
  background: var(--docbot-primary-300);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

#docbot-chat-container #docbot-chat-header {
  padding: 15px 20px;
  color: black;
  text-align: left;
  font-size: 18px;
  font-weight: 500;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  position: sticky;
  top: 0;
  z-index: 2; /* bleibt über den Messages */
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  background-color: white;
}

/* Header Untertitel kleiner darstellen */
#docbot-chat-header #docbot-header-subtitle {
  font-size: 14px;
  font-weight: normal;
  margin-top: 4px;
  width: 90%;
}

#docbot-chat-container #docbot-chat-messages {
  flex: 1;
  padding: 10px 20px 30px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-top: 1px solid #ccc;
  margin-bottom: -30px;
  background-color: white;
}

#docbot-chat-container .docbot-chat-message {
  margin: 10px 0 30px 0;
  padding: 12px 16px;
  border-radius: 20px;
  max-width: 80%;
  word-wrap: break-word;
  white-space: pre-wrap;
  font-family: "Poppins", sans-serif;
  position: relative;
  font-size: 15px;
}

#docbot-chat-container .docbot-chat-bot-message {
  background-color: var(--docbot-primary-200);
  align-self: flex-start;
  color: black;
}

#docbot-chat-container .docbot-chat-user-message {
  background-color: var(--docbot-primary-500);
  color: white;
  align-self: flex-end;
  margin-left: auto;
}

#docbot-chat-container .docbot-chat-typing {
  font-style: italic;
  color: grey;
}

#docbot-chat-container #docbot-chat-input {
  display: flex;
  align-items: center;
  background: white;
  border-radius: 24px;
  box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 4px;
  margin: 0 20px 15px 20px;
  z-index: 100;
  box-sizing: border-box;
  border: 3px solid transparent;
  overflow: hidden;
  transition: outline 100ms ease-in-out, box-shadow 150ms ease-in-out,
    background 150ms;
  touch-action: none; /* verhindert Drag‑Scrolling */
}

/* --- Animierbare Variable für den Winkel des Conic‑Gradients --- */
@property --docbot-gradient-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

/* Farbverlauf-Rand animiert: rotiert und vermischt sich im Uhrzeigersinn */
#docbot-chat-container #docbot-chat-input:focus-within {
  border: 3px solid transparent;
  border-radius: 24px;
  background: linear-gradient(white, white) padding-box,
    conic-gradient(
        from var(--docbot-gradient-angle, 0deg),
        #7b60feff,
        #49cdfdff,
        #3990fdff,
        #7b60feff
      )
      border-box;
  animation: docbot-gradient-rotate 2s linear infinite;
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

@keyframes docbot-gradient-rotate {
  to {
    --docbot-gradient-angle: 360deg;
  }
}

#docbot-chat-container #docbot-chat-input textarea {
  flex: 1;
  padding: 15px 0 15px 15px;
  border: none;
  resize: none;
  font-family: "Poppins", sans-serif;
  min-height: 50px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 20px;
  outline: none;
  box-sizing: border-box;
  border-radius: 24px;
  background: white;
}

#docbot-chat-container #docbot-chat-send-icon {
  width: 40px;
  height: 40px;
  cursor: pointer;
  margin: 0 10px;
}

/* ausgegrauter, inaktiver Send‑Button */
#docbot-chat-container #docbot-chat-send-icon.disabled {
  opacity: 0.35; /* hell / ausgebleicht */
  pointer-events: none; /* nicht klickbar */
}

#docbot-chat-container #docbot-chat-send-icon svg {
  position: relative;
  width: 100%;
  height: 100%;
}

#docbot-chat-container .docbot-chat-message .timestamp {
  display: block;
  font-size: 10px;
  margin-top: 5px;
  position: absolute;
  bottom: -18px;
}

#docbot-chat-container .docbot-chat-user-message .timestamp {
  color: var(--docbot-primary-500);
  text-align: right;
  right: 10px;
}

#docbot-chat-container .docbot-chat-bot-message .timestamp {
  color: var(--docbot-primary-500);
  text-align: left;
  left: 20px;
}

#docbot-chat-container .bubble-svg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

#docbot-chat-container #docbot-chat-icon {
  width: 40%;
  height: 40%;
  padding-top: 3px;
  transition: all 0.1s ease-in;
}

#docbot-chat-container .docbot-chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

#docbot-chat-container .docbot-chat-quick-reply {
  background-color: #ffffff; /* weißer Hintergrund */
  background-image: none; /* entfernt Hover‑Gradient, wenn nicht aktiv */
  animation: none; /* stoppt evtl. laufende Rotation */
  border: 3px solid transparent;
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 4px; /* gleicher Schatten wie Textarea */
  color: #000000; /* schwarzer Text */
  border-radius: 30px;
  padding: 8px 16px;
  margin: 5px;
  cursor: pointer;
  font-size: 14px;
  display: inline-block;
  text-decoration: none;
  font-family: "Poppins", sans-serif;
}

#docbot-chat-container .docbot-chat-quick-reply:hover {
  border: 3px solid transparent;
  background: linear-gradient(white, white) padding-box,
    conic-gradient(
        from var(--docbot-gradient-angle, 0deg),
        #7b60feff,
        #49cdfdff,
        #3990fdff,
        #7b60feff
      )
      border-box;
  animation: docbot-gradient-rotate 2s linear infinite;
  background-origin: border-box;
  background-clip: padding-box, border-box;
  color: #000000;
}

#docbot-chat-container #docbot-privacy-link {
  font-size: 10px;
  text-align: center;
  margin-top: 5px;
  margin-bottom: 5px;
  color: var(--docbot-primary-500);
  text-decoration: none;
  cursor: pointer;
  display: block;
  font-family: "Poppins", sans-serif;
}

#docbot-chat-container #docbot-privacy-link:hover {
  text-decoration: underline;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Tippindikator-Stile */
.typing-indicator {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 50px; /* Optional: für bessere Sichtbarkeit */
  padding: 10px 0;
}

.typing-indicator .dot {
  width: 8px;
  height: 8px;
  margin: 0 4px;
  background-color: #555;
  border-radius: 50%;
  opacity: 0;
  animation: blink 1.4s infinite both;
}

.typing-indicator .dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
}

/* ===== iOS scroll fix =============================================== */
#docbot-chat-messages {
  -webkit-overflow-scrolling: touch; /* enable momentum scrolling on iOS */
  overscroll-behavior: contain; /* prevent scroll chaining to <body> */
}

/* Close‑Knopf im Header */
#docbot-close-button {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  position: absolute;
  top: 50%;
  right: 15px;
  left: auto;
  transform: translateY(-50%);
  color: var(--docbot-primary-800);
  width: 1.5em;
  height: 1.5em;
  aspect-ratio: 1 / 1;
  padding: 0;
  line-height: 1;
  text-align: center;
}

#docbot-close-button:hover {
  color: var(--docbot-primary-500);
  background: rgba(34, 34, 34, 0.06);
  border-radius: 8px;
}

/* === Mini‑Chat‑Preview über der Bubble =============================== */
#docbot-chat-preview {
  position: fixed;
  bottom: 95px;
  right: 25px;
  width: 340px;
  max-width: 90%;
  display: none;
  flex-direction: column;
  background: transparent;
  border-radius: 16px;
  box-shadow: none;
  padding: 20px 20px 16px 20px;
  z-index: 102;
  font-family: "Poppins", sans-serif;
  opacity: 0;
  transform: translateY(40px);
  animation: docbot-preview-fadein-up 0.35s cubic-bezier(0.4, 1.4, 0.6, 1)
    forwards;
}

@keyframes docbot-preview-fadein-up {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#docbot-chat-preview .docbot-preview-message {
  background-color: white;
  box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 4px;
  color: black;
  border-radius: 20px;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.4;
  white-space: pre-wrap;
}

#docbot-chat-preview .docbot-preview-input {
  transition: outline 100ms ease-in-out, box-shadow 150ms ease-in-out,
    background 150ms;
  position: relative; /* für spätere Pseudo‑Layer */
  display: flex;
  align-items: center;
  border: 3px solid transparent;
  border-radius: 24px;
  background: white;
  box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 4px;
  margin-top: 10px; /* Abstand nach oben hinzugefügt */
}

#docbot-chat-preview .docbot-preview-input textarea {
  flex: 1;
  border: none;
  padding: 15px;
  font-family: "Poppins", sans-serif;
  resize: none;
  font-size: 14px;
  line-height: 20px;
  min-height: 50px;
  max-height: 200px;
  outline: none;
  background: white;
  box-sizing: border-box;
  border-radius: 24px;
}

#docbot-chat-preview .docbot-chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 10px;
}

#docbot-chat-preview .docbot-chat-quick-reply {
  background-color: #ffffff;
  border: 3px solid transparent;
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 4px;
  color: #000000;
  border-radius: 30px;
  padding: 6px 12px;
  margin: 5px;
  cursor: pointer;
  font-size: 13px;
  display: inline-block;
  text-decoration: none;
  font-family: "Poppins", sans-serif;
}

#docbot-chat-preview .docbot-chat-quick-reply:hover {
  border: 3px solid transparent;
  background: linear-gradient(white, white) padding-box,
    conic-gradient(
        from var(--docbot-gradient-angle, 0deg),
        #7b60feff,
        #49cdfdff,
        #3990fdff,
        #7b60feff
      )
      border-box;
  animation: docbot-gradient-rotate 2s linear infinite;
  background-origin: border-box;
  background-clip: padding-box, border-box;
  color: #000000;
}

/* Schließen-Button für die Chat-Preview */
#docbot-preview-close-button {
  background: white;
  border: none;
  font-size: 1.4em;
  cursor: pointer;
  position: absolute;
  top: -15px;
  right: 20px;
  color: var(--docbot-primary-500);
  width: 1.2em;
  height: 1.2em;
  padding: 0;
  text-align: center;
  display: flex; /* Flexbox für Zentrierung */
  align-items: center; /* Vertikale Zentrierung */
  justify-content: center; /* Horizontale Zentrierung */
  z-index: 103;
  box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 4px;
  border-radius: 8px;
}

#docbot-preview-close-button:hover {
  color: var(--docbot-primary-500);
  background: rgba(34, 34, 34, 0.06);
  border-radius: 8px;
}

/* ========== Media Queries ========== */

/* Responsive Darstellung des Chat-Fensters */
@media (max-width: 700px) {
  #docbot-chat-container #docbot-chat-window {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    max-width: 100%;
    max-height: 100%;
    min-height: unset;
    min-width: unset;
    overscroll-behavior: none;
  }

  #docbot-chat-container #docbot-chat-input textarea {
    font-size: 16px;
  }

  #docbot-chat-container #docbot-chat-input {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  #docbot-chat-container #docbot-chat-bubble.open {
    top: 14px;
    left: 0;
    bottom: auto;
    right: auto;
  }

  #docbot-chat-container #docbot-chat-header {
    padding-left: 30px;
    border-radius: 0;
    font-size: 14px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  #docbot-chat-container #docbot-chat-messages {
    margin-bottom: 40px;
  }

  #docbot-chat-preview {
    right: auto;
    left: 50%;
    transform: translateX(-50%) translateY(40px);
    width: calc(100% - 40px); /* 20px Abstand links und rechts */
    max-width: 480px;
  }

  #docbot-chat-preview.visible {
    transform: translateX(-50%) translateY(0);
  }

  @keyframes docbot-preview-fadein-up {
    from {
      opacity: 0;
      transform: translateX(-50%) translateY(40px);
    }
    to {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
  }
}
