/* ========== CHATBOT ========== */

/* ---------- Eigene Chatbot-Variablen ---------- */

.chatbot {
    --chatbot-dunkel: #17384f;
    --chatbot-dunkel-hover: #102c3f;
    --chatbot-akzent: #7fa5ce;
    --chatbot-hell: #ffffff;
    --chatbot-hintergrund: #f5f7fa;
    --chatbot-text: #1d2a33;
    --chatbot-text-gedaempft: #6d7b86;
    --chatbot-linie: #dde4ea;
    --chatbot-benutzer: #17384f;
    --chatbot-schatten: 0 20px 60px rgba(17, 38, 54, 0.18);

    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 1500;
    font-family: var(--schrift-text, sans-serif);
}

/* ---------- Hidden sicher ausblenden ---------- */

.chatbot-fenster[hidden] {
    display: none;
}

/* ========== CHATBUTTON ========== */

/* ---------- Schalter ---------- */

.chatbot-schalter {
    display: inline-flex;
    min-height: 3.5rem;
    padding: 0.85rem 1.2rem;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;

    border: 0;
    border-radius: 999px;

    background-color: var(--chatbot-dunkel);
    color: var(--chatbot-hell);

    box-shadow:
        0 8px 25px rgba(23, 56, 79, 0.24);

    cursor: pointer;

    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;

    transition:
        background-color 180ms ease,
        transform 180ms ease,
        box-shadow 180ms ease;
}

/* ---------- Hover ---------- */

.chatbot-schalter:hover {
    background-color: var(--chatbot-dunkel-hover);
    transform: translateY(-2px);

    box-shadow:
        0 12px 30px rgba(23, 56, 79, 0.3);
}

/* ---------- Tastaturfokus ---------- */

.chatbot-schalter:focus-visible {
    outline: 3px solid var(--chatbot-akzent);
    outline-offset: 4px;
}

/* ---------- Chat-Symbol ---------- */

.chatbot-schalter-symbol {
    width: 1.25rem;
    height: 1.25rem;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ========== CHATFENSTER ========== */

/* ---------- Grundfläche ---------- */

.chatbot-fenster {
    position: absolute;
    right: 0;
    bottom: calc(100% + 1rem);

    display: grid;
    grid-template-rows:
        auto minmax(0, 1fr) auto auto auto;

    width: min(390px, calc(100vw - 3rem));
    height: min(620px, calc(100vh - 8rem));

    overflow: hidden;

    border: 1px solid var(--chatbot-linie);
    border-radius: 1.25rem;

    background-color: var(--chatbot-hell);

    box-shadow: var(--chatbot-schatten);

    animation: chatbot-einblenden 180ms ease;
}

/* ---------- Öffnungsanimation ---------- */

@keyframes chatbot-einblenden {
    from {
        opacity: 0;
        transform: translateY(0.75rem) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========== CHATBOT KOPF ========== */

/* ---------- Kopfbereich ---------- */

.chatbot-kopf {
    display: flex;
    min-height: 5rem;
    padding: 1rem 1.15rem;

    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    background-color: var(--chatbot-dunkel);
    color: var(--chatbot-hell);
}

/* ---------- Linker Bereich ---------- */

.chatbot-kopf-info {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.8rem;
}

/* ---------- Statuspunkt ---------- */

.chatbot-statuspunkt {
    flex-shrink: 0;

    width: 0.7rem;
    height: 0.7rem;

    border: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;

    background-color: #79c58c;

    box-shadow:
        0 0 0 4px rgba(121, 197, 140, 0.12);
}

/* ---------- Titel ---------- */

.chatbot-titel {
    color: var(--chatbot-hell);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
}

/* ---------- Untertitel ---------- */

.chatbot-untertitel {
    margin-top: 0.15rem;

    color: rgba(255, 255, 255, 0.68);
    font-size: 0.72rem;
    line-height: 1.4;
}

/* ========== CHATBOT KOPF-AKTIONEN ========== */

/* ---------- Aktionen rechts ---------- */

.chatbot-kopf-aktionen {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.35rem;
}

/* ---------- Neues Gespräch ---------- */

.chatbot-zuruecksetzen {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;

  border: 0;
  border-radius: 50%;

  background-color: rgba(255, 255, 255, 0.08);
  color: var(--chatbot-hell);

  cursor: pointer;

  transition:
    background-color 180ms ease,
    transform 180ms ease;
}

.chatbot-zuruecksetzen:hover {
  background-color: rgba(255, 255, 255, 0.16);
  transform: rotate(-20deg);
}

.chatbot-zuruecksetzen:focus-visible {
  outline: 2px solid var(--chatbot-akzent);
  outline-offset: 2px;
}

/* ---------- Symbol ---------- */

.chatbot-zuruecksetzen svg {
  width: 1.1rem;
  height: 1.1rem;

  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Deaktiviert ---------- */

.chatbot-zuruecksetzen:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ========== SCHLIESSEN ========== */

/* ---------- Schließen-Button ---------- */

.chatbot-schliessen {
    position: relative;

    flex-shrink: 0;

    width: 2.4rem;
    height: 2.4rem;

    border: 0;
    border-radius: 50%;

    background-color: rgba(255, 255, 255, 0.08);

    cursor: pointer;

    transition:
        background-color 180ms ease,
        transform 180ms ease;
}

.chatbot-schliessen:hover {
    background-color: rgba(255, 255, 255, 0.16);
    transform: rotate(4deg);
}

.chatbot-schliessen:focus-visible {
    outline: 2px solid var(--chatbot-akzent);
    outline-offset: 2px;
}

/* ---------- X ---------- */

.chatbot-schliessen::before,
.chatbot-schliessen::after {
    position: absolute;
    top: 50%;
    left: 50%;

    width: 1rem;
    height: 1.5px;

    border-radius: 999px;

    background-color: var(--chatbot-hell);

    content: "";
}

.chatbot-schliessen::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.chatbot-schliessen::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* ========== CHATVERLAUF ========== */

/* ---------- Nachrichtenbereich ---------- */

.chatbot-verlauf {
    display: flex;
    min-height: 0;
    padding: 1.15rem;

    flex-direction: column;
    gap: 0.9rem;

    overflow-y: auto;
    overscroll-behavior: contain;

    background-color: var(--chatbot-hintergrund);

    scrollbar-width: thin;
    scrollbar-color:
        var(--chatbot-linie) transparent;
}

/* ---------- Scrollbar Chrome ---------- */

.chatbot-verlauf::-webkit-scrollbar {
    width: 0.4rem;
}

.chatbot-verlauf::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-verlauf::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background-color: var(--chatbot-linie);
}

/* ========== NACHRICHTEN ========== */

/* ---------- Allgemeine Nachricht ---------- */

.chatbot-nachricht {
  display: flex;
  flex: 0 0 auto;
  width: 100%;
}

/* ---------- Nachrichtenbox ---------- */

.chatbot-nachricht-inhalt {
    max-width: 84%;
    padding: 0.8rem 0.95rem;

    border-radius: 1rem;

    font-size: 0.84rem;
    line-height: 1.6;
}

/* ---------- Nachrichtentext ---------- */

.chatbot-nachricht-inhalt p {
  margin: 0;
  white-space: pre-line;
}

/* ---------- Absätze innerhalb einer Nachricht ---------- */

.chatbot-nachricht-inhalt p+p {
    margin-top: 0.55rem;
}

/* ---------- Bot-Nachricht ---------- */

.chatbot-nachricht--bot {
    justify-content: flex-start;
}

.chatbot-nachricht--bot .chatbot-nachricht-inhalt {
    border: 1px solid var(--chatbot-linie);
    border-bottom-left-radius: 0.3rem;

    background-color: var(--chatbot-hell);
    color: var(--chatbot-text);
}

/* ---------- Benutzer-Nachricht ---------- */

.chatbot-nachricht--benutzer {
    justify-content: flex-end;
}

.chatbot-nachricht--benutzer .chatbot-nachricht-inhalt {
    border-bottom-right-radius: 0.3rem;

    background-color: var(--chatbot-benutzer);
    color: var(--chatbot-hell);
}

/* ========== STATUS ========== */

/* ---------- Lade- und Fehlermeldungen ---------- */

.chatbot-status {
    min-height: 0;
    padding-inline: 1.15rem;

    background-color: var(--chatbot-hintergrund);

    color: var(--chatbot-text-gedaempft);
    font-size: 0.7rem;
    line-height: 1.4;
}

/* ---------- Nur anzeigen wenn Text vorhanden ---------- */

.chatbot-status:not(:empty) {
    padding-top: 0.35rem;
    padding-bottom: 0.65rem;
}

/* ========== EINGABEBEREICH ========== */

/* ---------- Formular ---------- */

.chatbot-formular {
    padding: 0.9rem 1rem;

    border-top: 1px solid var(--chatbot-linie);

    background-color: var(--chatbot-hell);
}

/* ---------- Unsichtbares Label ---------- */

.chatbot-label {
    position: absolute;

    width: 1px;
    height: 1px;

    padding: 0;
    margin: -1px;

    overflow: hidden;

    clip: rect(0, 0, 0, 0);
    white-space: nowrap;

    border: 0;
}

/* ---------- Feld + Button ---------- */

.chatbot-eingabebereich {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr) 2.8rem;

    gap: 0.65rem;

    align-items: end;

    padding: 0.45rem 0.45rem 0.45rem 0.8rem;

    border: 1px solid var(--chatbot-linie);
    border-radius: 1rem;

    background-color: var(--chatbot-hintergrund);

    transition:
        border-color 180ms ease,
        box-shadow 180ms ease;
}

/* ---------- Fokus des gesamten Bereichs ---------- */

.chatbot-eingabebereich:focus-within {
    border-color: var(--chatbot-akzent);

    box-shadow:
        0 0 0 3px rgba(127, 165, 206, 0.13);
}

/* ---------- Textarea ---------- */

.chatbot-eingabe {
    width: 100%;
    max-height: 8rem;

    padding: 0.5rem 0;

    border: 0;
    outline: 0;

    resize: none;

    overflow-y: auto;

    background-color: transparent;
    color: var(--chatbot-text);

    font-family: inherit;
    font-size: 0.82rem;
    line-height: 1.5;
}

/* ---------- Placeholder ---------- */

.chatbot-eingabe::placeholder {
    color: var(--chatbot-text-gedaempft);
}

/* ========== SENDEN ========== */

/* ---------- Senden-Button ---------- */

.chatbot-senden {
    display: grid;

    width: 2.8rem;
    height: 2.8rem;

    place-items: center;

    border: 0;
    border-radius: 0.8rem;

    background-color: var(--chatbot-dunkel);
    color: var(--chatbot-hell);

    cursor: pointer;

    transition:
        background-color 180ms ease,
        transform 180ms ease;
}

.chatbot-senden:hover {
    background-color: var(--chatbot-dunkel-hover);
    transform: translateX(2px);
}

.chatbot-senden:focus-visible {
    outline: 2px solid var(--chatbot-akzent);
    outline-offset: 2px;
}

/* ---------- Senden-Symbol ---------- */

.chatbot-senden svg {
    width: 1.2rem;
    height: 1.2rem;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Deaktivierter Button ---------- */

.chatbot-senden:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* ========== CHATBOT HINWEIS ========== */

/* ---------- Unterer Hinweis ---------- */

.chatbot-hinweis {
    padding:
        0 1rem 0.85rem;

    background-color: var(--chatbot-hell);

    text-align: center;
}

.chatbot-hinweis p {
    color: var(--chatbot-text-gedaempft);
    font-size: 0.62rem;
    line-height: 1.45;
}

/* ========== CHATBOT TABLET ========== */

@media (max-width: 800px) {
    .chatbot {
        right: 1rem;
        bottom: 1rem;
    }

    .chatbot-fenster {
        width: min(380px,
                calc(100vw - 2rem));
    }
}

/* ========== CHATBOT SMARTPHONE ========== */

@media (max-width: 520px) {
    /* ---------- Position ---------- */

    .chatbot {
        right: 0.75rem;
        bottom: 0.75rem;
        left: 0.75rem;
    }

    /* ---------- Fenster ---------- */

    .chatbot-fenster {
        position: fixed;

        top: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
        left: 0.75rem;

        width: auto;
        height: auto;

        border-radius: 1rem;
    }

    /* ---------- Button rechts halten ---------- */

    .chatbot-schalter {
        margin-left: auto;
    }

    /* ---------- Text auf Button ausblenden ---------- */

    .chatbot-schalter-text {
        display: none;
    }

    /* ---------- Runder Button ---------- */

    .chatbot-schalter {
        width: 3.5rem;
        padding: 0;
    }

    /* ---------- Nachrichten ---------- */

    .chatbot-nachricht-inhalt {
        max-width: 90%;
    }
}

/* ========== CHATBOT GEÖFFNET ========== */

@media (max-width: 520px) {
  body.chatbot-ist-offen {
    overflow: hidden;
  }
}

/* ========== CHATBOT PROJEKTANFRAGE ========== */

/* ---------- Anfrage-Aktion ---------- */

.chatbot-anfrage-aktion {
  display: flex;
  justify-content: flex-start;

  width: 100%;
}

/* ---------- Anfrage öffnen ---------- */

.chatbot-anfrage-start {
  padding: 0.75rem 1rem;

  border: 0;
  border-radius: 0.8rem;

  background-color: var(--chatbot-dunkel);
  color: var(--chatbot-hell);

  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;

  cursor: pointer;

  transition:
    background-color 180ms ease,
    transform 180ms ease;
}

.chatbot-anfrage-start:hover {
  background-color:
    var(--chatbot-dunkel-hover);

  transform: translateY(-1px);
}

.chatbot-anfrage-start:focus-visible {
  outline:
    2px solid
    var(--chatbot-akzent);

  outline-offset: 2px;
}

/* ========== ANFRAGEFORMULAR ========== */

/* ---------- Formularbox ---------- */

.chatbot-anfrage-box {
  width: 100%;
  padding: 1rem;

  border:
    1px solid
    var(--chatbot-linie);

  border-radius: 1rem;

  background-color:
    var(--chatbot-hell);
}

/* ---------- Kopf ---------- */

.chatbot-anfrage-kopf {
  margin-bottom: 1rem;
}

/* ---------- Titel ---------- */

.chatbot-anfrage-titel {
  margin: 0;

  color: var(--chatbot-text);

  font-size: 0.9rem;
  font-weight: 600;
}

/* ---------- Beschreibung ---------- */

.chatbot-anfrage-text {
  margin-top: 0.3rem;

  color:
    var(--chatbot-text-gedaempft);

  font-size: 0.72rem;
  line-height: 1.5;
}

/* ---------- Formular ---------- */

.chatbot-anfrage-formular {
  display: grid;
  gap: 0.75rem;
}

/* ---------- Feld ---------- */

.chatbot-anfrage-feld {
  display: grid;
  gap: 0.3rem;
}

.chatbot-anfrage-feld label {
  color: var(--chatbot-text);

  font-size: 0.7rem;
  font-weight: 600;
}

/* ---------- Input und Textarea ---------- */

.chatbot-anfrage-feld input,
.chatbot-anfrage-feld textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;

  border:
    1px solid
    var(--chatbot-linie);

  border-radius: 0.65rem;

  outline: 0;

  background-color:
    var(--chatbot-hintergrund);

  color:
    var(--chatbot-text);

  font-family: inherit;
  font-size: 0.75rem;

  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

/* ---------- Fokus ---------- */

.chatbot-anfrage-feld input:focus,
.chatbot-anfrage-feld textarea:focus {
  border-color:
    var(--chatbot-akzent);

  box-shadow:
    0 0 0 3px
    rgba(127, 165, 206, 0.13);
}

/* ---------- Textarea ---------- */

.chatbot-anfrage-feld textarea {
  min-height: 6rem;
  resize: vertical;
}

/* ========== SPAM-SCHUTZ ========== */

/* ---------- Honeypot ---------- */

.chatbot-honigfalle {
  position: absolute;

  width: 1px;
  height: 1px;

  overflow: hidden;

  left: -10000px;
}

/* ========== DATENSCHUTZ ========== */

.chatbot-anfrage-datenschutz {
  margin: 0;

  color:
    var(--chatbot-text-gedaempft);

  font-size: 0.6rem;
  line-height: 1.5;
}

.chatbot-anfrage-datenschutz a {
  color:
    var(--chatbot-dunkel);

  text-decoration: underline;
}

/* ========== ANFRAGE SENDEN ========== */

.chatbot-anfrage-senden {
  width: 100%;
  padding: 0.75rem;

  border: 0;
  border-radius: 0.7rem;

  background-color:
    var(--chatbot-dunkel);

  color:
    var(--chatbot-hell);

  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;

  cursor: pointer;
}

.chatbot-anfrage-senden:hover {
  background-color:
    var(--chatbot-dunkel-hover);
}

.chatbot-anfrage-senden:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Status ---------- */

.chatbot-anfrage-status {
  min-height: 1rem;
  margin: 0;

  color:
    var(--chatbot-text-gedaempft);

  font-size: 0.65rem;
}

/* ========== ANFRAGE ERFOLG ========== */

.chatbot-anfrage-erfolg {
  padding: 0.5rem 0;

  color:
    var(--chatbot-text);

  font-size: 0.75rem;
  line-height: 1.6;
}

.chatbot-anfrage-erfolg-titel {
  margin-bottom: 0.25rem;

  font-size: 0.9rem;
  font-weight: 600;
}

/* ---------- Datenschutzlink ---------- */

.chatbot-hinweis a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15rem;
}

.chatbot-hinweis a:hover {
  color: var(--chatbot-dunkel);
}