/*
 * Laura – DigGesV Support-Chat
 * Vollständige, abgestimmte CSS-Datei
 */

/* =========================================================
   Grundregeln
   ========================================================= */

.dg-laura,
.dg-laura *,
.dg-laura__panel,
.dg-laura__panel *,
.dg-laura__backdrop {
  box-sizing: border-box;
}

.dg-laura,
.dg-laura__panel {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
}

.dg-laura {
  position: fixed;
  right: 18px;
  bottom: 96px;
  z-index: 100;

  display: block;
  visibility: visible;
  opacity: 1;
}

/* Position des kleinen Buttons in der Support-Karte */
.dg-laura-inline-slot {
  position: relative;

  width: 56px;
  height: 56px;
  margin-top: 14px;

  overflow: visible;
  z-index: 100;
}

.dg-laura--embedded {
  position: relative;

  right: auto;
  bottom: auto;

  width: 56px;
  height: 56px;

  overflow: visible;
}


/* =========================================================
   Kleiner Laura-Button
   ========================================================= */

.dg-laura__fab {
  position: relative;
  z-index: 2;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 56px;
  height: 56px;
  padding: 0;

  border: 2px solid rgba(31, 178, 91, 0.45);
  border-radius: 999px;

  background: #ffffff;
  box-shadow:
    0 12px 28px rgba(15, 23, 42, 0.20),
    0 3px 8px rgba(15, 23, 42, 0.12);

  cursor: pointer;

  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.94);
  pointer-events: none;

  transition:
    opacity 0.22s ease,
    visibility 0.22s ease,
    transform 0.22s ease,
    box-shadow 0.22s ease;
}

.dg-laura.is-ready .dg-laura__fab {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dg-laura__fab:hover {
  transform: translateY(-2px) scale(1.04);

  box-shadow:
    0 16px 34px rgba(15, 23, 42, 0.24),
    0 4px 10px rgba(15, 23, 42, 0.14);
}

.dg-laura__fab:focus-visible {
  outline: 4px solid rgba(31, 178, 91, 0.25);
  outline-offset: 4px;
}

.dg-laura.is-open .dg-laura__fab {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9);
  pointer-events: none;
}

.dg-laura__fabAvatar {
  display: block;

  width: 46px !important;
  height: 46px !important;

  border-radius: 999px;
  object-fit: cover;
}

.dg-laura__fabText {
  display: none !important;
}


/* =========================================================
   Vollflächiger Hintergrund
   ========================================================= */

body.dg-laura-modal-open {
  overflow: hidden;
}

.dg-laura__backdrop {
  position: fixed;
  inset: 0;

  z-index: 2147483000;

  display: block;

  background: rgba(15, 23, 42, 0.64);

  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition:
    opacity 0.22s ease,
    visibility 0.22s ease;
}

body.dg-laura-modal-open .dg-laura__backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}


/* =========================================================
   Chatfenster
   ========================================================= */

.dg-laura__panel {
  position: fixed;

  left: 50%;
  top: 57%;
  right: auto;
  bottom: auto;

  z-index: 2147483001;

  display: flex;
  flex-direction: column;

  width: min(400px, calc(100vw - 32px));
  height: min(520px, calc(100dvh - 70px));
  max-height: calc(100dvh - 70px);

  margin: 0;

  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 20px;

  overflow: hidden;

  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.38),
    0 10px 30px rgba(0, 0, 0, 0.22);

  opacity: 0;
  visibility: hidden;

  transform:
    translate(-50%, -46%)
    scale(0.96);

  transform-origin: center;
  pointer-events: none;

  transition:
    opacity 0.22s ease,
    visibility 0.22s ease,
    transform 0.22s ease;
}

body.dg-laura-modal-open .dg-laura__panel {
  opacity: 1;
  visibility: visible;

  transform:
    translate(-50%, -50%)
    scale(1);

  pointer-events: auto;
}


/* =========================================================
   Kopfbereich
   ========================================================= */

.dg-laura__head {
  position: relative;

  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;

  min-height: 72px;
  padding: 14px 60px 14px 16px;

  background:
    linear-gradient(
      100deg,
      rgba(31, 178, 91, 0.18),
      rgba(43, 127, 255, 0.13)
    );

  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.dg-laura__headLeft {
  display: flex;
  align-items: center;
  gap: 10px;

  min-width: 0;
}

.dg-laura__avatar {
  display: block;
  flex: 0 0 auto;

  width: 40px !important;
  height: 40px !important;

  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;

  object-fit: cover;

  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.14);
}

.dg-laura__titles {
  min-width: 0;
}

.dg-laura__name {
  margin: 0;

  color: #172033;

  font-size: 1rem;
  font-weight: 750;
  line-height: 1.2;
}

.dg-laura__status {
  margin-top: 2px;

  color: #526071;

  font-size: 0.82rem;
  line-height: 1.2;
}


/* =========================================================
   Roter Schließen-Button
   ========================================================= */

.dg-laura__close {
  position: absolute !important;
  top: 16px;
  right: 14px;

  z-index: 10;

  display: inline-flex !important;
  align-items: center;
  justify-content: center;

  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  padding: 0 !important;
  margin: 0 !important;

  border: 2px solid #ffffff !important;
  border-radius: 999px !important;

  background: #d92d20 !important;
  color: #ffffff !important;

  box-shadow:
    0 5px 14px rgba(217, 45, 32, 0.40),
    0 2px 5px rgba(15, 23, 42, 0.16);

  font-family: Arial, sans-serif;
  font-size: 25px !important;
  font-weight: 700;
  line-height: 1;

  cursor: pointer;

  opacity: 1;
  visibility: visible;

  transition:
    background 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.dg-laura__close:hover {
  background: #b42318 !important;
  transform: scale(1.08);
}

.dg-laura__close:focus-visible {
  outline: 4px solid rgba(217, 45, 32, 0.30);
  outline-offset: 3px;
}


/* =========================================================
   Nachrichten
   ========================================================= */

.dg-laura__msgs {
  flex: 1 1 auto;

  min-height: 0;
  padding: 16px;

  overflow-x: hidden;
  overflow-y: auto;

  background:
    linear-gradient(
      180deg,
      rgba(248, 250, 252, 0.96),
      #ffffff
    );

  text-align: left;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.dg-laura__msg {
  display: inline-block;

  max-width: 88%;
  margin: 6px 0;
  padding: 10px 12px;

  border: 1px solid rgba(15, 23, 42, 0.09);
  border-radius: 14px;

  background: #f5f6f8;
  color: #253044;

  font-size: 0.94rem;
  line-height: 1.48;

  overflow-wrap: anywhere;
  white-space: pre-line;
}

.dg-laura__msg--bot {
  border-bottom-left-radius: 5px;
}

.dg-laura__msg--me {
  display: block;

  margin-left: auto;

  background: rgba(31, 178, 91, 0.11);
  border-color: rgba(31, 178, 91, 0.25);
  border-bottom-right-radius: 5px;
}


/* =========================================================
   Eingabebereich
   ========================================================= */

.dg-laura__form {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;

  padding: 11px;

  background: #ffffff;
  border-top: 1px solid rgba(15, 23, 42, 0.09);
}

.dg-laura__input {
  flex: 1 1 auto;

  min-width: 0;
  height: 44px;
  padding: 10px 12px;

  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 12px;

  background: #ffffff;
  color: #172033;

  font: inherit;
  font-size: 0.92rem;

  outline: none;
}

.dg-laura__input:focus {
  border-color: rgba(31, 178, 91, 0.70);
  box-shadow: 0 0 0 4px rgba(31, 178, 91, 0.12);
}

.dg-laura__send {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;

  flex: 0 0 auto;

  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;

  border: 0 !important;
  border-radius: 12px !important;

  background: #1fb25b !important;
  color: #ffffff !important;

  font-size: 18px;
  font-weight: 800;

  cursor: pointer;
}

.dg-laura__send:hover {
  background: #168d47 !important;
}


/* =========================================================
   Smartphones und Tablets
   ========================================================= */

@media (max-width: 700px) {
  .dg-laura {
    right: 12px;
    bottom: 12px;
  }

  .dg-laura-inline-slot,
  .dg-laura--embedded,
  .dg-laura__fab {
    width: 54px;
    height: 54px;
  }

  .dg-laura__fabAvatar {
    width: 44px !important;
    height: 44px !important;
  }

  /*
   * Die dynamische Viewport-Höhe wird kleiner,
   * sobald die Bildschirmtastatur geöffnet wird.
   */
  .dg-laura__panel {
    position: absolute;
    left: max(8px, env(safe-area-inset-left));
    top: calc(
      var(--dg-laura-vv-top, 0px) +
   
   max(8px, env(safe-area-inset-top))
    );
    right: max(8px, env(safe-area-inset-right));
    bottom: auto;

    width: auto;
    height: calc(
      var(--dg-laura-vv-height, 100dvh) -
      16px
    );

    max-height: calc(
      var(--dg-laura-vv-height, 100dvh) -
      16px
    );
    min-height: 0;

    border-radius: 16px;

    transform: translateY(16px) scale(0.98);
    transform-origin: center bottom;
  }

  body.dg-laura-modal-open .dg-laura__panel {
    transform: translateY(0) scale(1);
  }

  .dg-laura__head {
    min-height: 58px;
    padding: 8px 50px 8px 10px;
  }

  .dg-laura__headLeft {
    gap: 8px;
  }

  .dg-laura__avatar {
    width: 36px !important;
    height: 36px !important;
  }

  .dg-laura__name {
    font-size: 0.95rem;
    line-height: 1.15;
  }

  .dg-laura__status {
    margin-top: 1px;
    font-size: 0.76rem;
    line-height: 1.15;
  }

  .dg-laura__close {
    top: 11px;
    right: 10px;

    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;

    font-size: 22px !important;
  }

  .dg-laura__msgs {
    min-height: 0;
    padding: 10px;

    scroll-padding-top: 8px;
    scroll-padding-bottom: 8px;
  }

  .dg-laura__msg {
    max-width: 91%;
    margin: 4px 0;
    padding: 8px 10px;

    border-radius: 12px;

    font-size: 0.88rem;
    line-height: 1.38;
  }

  .dg-laura__msg--bot {
    border-bottom-left-radius: 4px;
  }

  .dg-laura__msg--me {
    border-bottom-right-radius: 4px;
  }

  .dg-laura__form {
    gap: 6px;
    padding:
      7px
      8px
      max(7px, env(safe-area-inset-bottom));
  }

  /*
   * Mindestens 16 px verhindern den automatischen
   * Safari-Zoom beim Antippen des Eingabefeldes.
   */
  .dg-laura__input {
    height: 42px;
    padding: 8px 10px;

    border-radius: 10px;

    font-size: 16px;
    line-height: 1.2;
  }

  .dg-laura__input:focus {
    box-shadow: 0 0 0 3px rgba(31, 178, 91, 0.12);
  }

  .dg-laura__send {
    width: 42px !important;
    height: 42px !important;

    border-radius: 10px !important;

    font-size: 17px;
  }

  .dg-laura__results {
    width: 92%;
    gap: 7px;
    margin: 2px 0 10px;
  }

  .dg-laura__result {
    padding: 9px 10px;
  }

  .dg-laura__resultExcerpt {
    -webkit-line-clamp: 3;
  }
}


/* =========================================================
   Kleine Smartphones
   ========================================================= */

@media (max-width: 380px) {
  .dg-laura__panel {
    left: max(5px, env(safe-area-inset-left));
    top: calc(
      var(--dg-laura-vv-top, 0px) +
      max(5px, env(safe-area-inset-top))
    );
    right: max(5px, env(safe-area-inset-right));

    height: calc(
      var(--dg-laura-vv-height, 100dvh) -
      10px
    );

    max-height: calc(
      var(--dg-laura-vv-height, 100dvh) -
      10px
    );
    border-radius: 13px;
  }

  .dg-laura__head {
    min-height: 54px;
    padding: 7px 46px 7px 8px;
  }

  .dg-laura__avatar {
    width: 34px !important;
    height: 34px !important;
  }

  .dg-laura__close {
    top: 9px;
    right: 8px;

    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;

    font-size: 21px !important;
  }

  .dg-laura__msgs {
    padding: 8px;
  }

  .dg-laura__msg {
    max-width: 94%;
    padding: 7px 9px;

    font-size: 0.86rem;
    line-height: 1.35;
  }

  .dg-laura__form {
    padding:
      6px
      7px
      max(6px, env(safe-area-inset-bottom));
  }

  .dg-laura__input {
    height: 40px;
    padding: 7px 9px;

    font-size: 16px;
  }

  .dg-laura__send {
    width: 40px !important;
    height: 40px !important;
  }
}


/* =========================================================
   Reduzierte Animationen
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .dg-laura__fab,
  .dg-laura__panel,
  .dg-laura__backdrop,
  .dg-laura__close,
  .dg-laura__send {
    transition: none !important;
    animation: none !important;
  }
}


/* =========================================================
   Treffer der Website-Volltextsuche
   ========================================================= */

.dg-laura__results {
  display: grid;
  gap: 9px;

  width: min(88%, 440px);
  margin: 3px 0 13px;
}

.dg-laura__result {
  display: block;

  padding: 11px 12px;

  color: inherit;
  text-decoration: none;

  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 9px;

  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.dg-laura__result:hover,
.dg-laura__result:focus-visible {
  color: inherit;

  background: #f6f7f7;
  border-color: #2271b1;

  outline: none;
}

.dg-laura__resultType {
  display: block;

  margin-bottom: 3px;

  color: #646970;

  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dg-laura__resultTitle {
  display: block;

  margin-bottom: 5px;

  color: #1d2327;

  font-size: 14px;
  line-height: 1.35;
}

.dg-laura__resultExcerpt {
  display: -webkit-box;
  overflow: hidden;

  color: #3c434a;

  font-size: 12px;
  line-height: 1.45;

  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.dg-laura__resultLink {
  display: block;

  margin-top: 7px;

  color: #135e96;

  font-size: 12px;
  font-weight: 600;
}

.dg-laura.is-waiting .dg-laura__input,
.dg-laura.is-waiting .dg-laura__send {
  cursor: wait;
  opacity: 0.65;
}
