/* Assuréo chatbot interface and responsive positioning. */

html:has(.assureo-chatbot.is-open),
body:has(.assureo-chatbot.is-open) {
  overflow: hidden;
}

.assureo-chatbot {
  position: fixed;
  z-index: 20;
  top: 26px;
  left: auto;
  right: 28px;
  bottom: auto;
  width: 340px;
  pointer-events: none;
}

.assureo-landing .assureo-chatbot {
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  width: 360px;
}

.assureo-landing.is-chat-open {
  overflow: visible;
}

.assureo-landing.is-chat-open .assureo-hero-copy {
  z-index: 1001;
}

.assureo-chatbot.is-open {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  background: rgba(6, 29, 80, .42);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  pointer-events: auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.assureo-landing .assureo-chatbot.is-open {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
}

.assureo-chatbot.is-open .assureo-chat-window {
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100vw - 48px));
  max-width: 100%;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  margin: 0;
  min-height: 0;
  overflow: hidden;
}

.assureo-chatbot.is-open .assureo-chat-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(420px, calc(100vh - 190px));
  max-height: min(420px, calc(100dvh - 190px));
}

.assureo-chatbot.is-open .assureo-chat-header {
  flex: 0 0 auto;
  border-radius: 22px 22px 0 0;
}

.assureo-chatbot.is-open .assureo-chat-launcher {
  display: none;
}

.assureo-landing .assureo-chat-welcome {
  width: 360px;
  margin-bottom: 0;
  margin-left: 20px;
  margin-top: 70px;
  padding: 18px 20px 17px;
}

.assureo-landing .assureo-chat-welcome-copy {
  display: block;
}

.assureo-landing .assureo-chat-welcome-copy img {
  display: none;
}

.assureo-landing .assureo-chat-welcome-copy p {
  font-size: 13px;
  line-height: 1.15;
}

.assureo-landing .assureo-chat-welcome-actions {
  grid-template-columns: 160px 140px;
  gap: 20px;
  margin-top: 9px;
}

.assureo-landing .assureo-chat-button {
  min-height: 40px;
  padding: 0 10px;
  font-size: 12px;
}

.assureo-landing .assureo-chat-launcher {
  position: absolute;
  bottom: 100px;
  left: 0;
  margin: 0;
}

.assureo-chatbot button,
.assureo-chatbot textarea {
  pointer-events: auto;
}

.assureo-chat-welcome,
.assureo-chat-window {
  position: relative;
  pointer-events: auto;
  border-radius: 22px;
  background: var(--assureo-white);
  box-shadow: 0 16px 38px rgba(6, 29, 80, .19);
}

.assureo-chat-welcome {
  margin-bottom: 15px;
  padding: 20px 18px 17px;
}

.assureo-chat-close {
  position: absolute;
  z-index: 2;
  top: -10px;
  right: -8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--assureo-red);
  color: var(--assureo-white);
  font-size: 21px;
  line-height: 1;
}

.assureo-chat-header .assureo-chat-close {
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}

.assureo-chat-close img {
  display: block;
  width: 11px;
  height: 11px;
  filter: brightness(0) invert(1);
}

.assureo-chat-welcome-copy {
  display: flex;
  align-items: center;
  gap: 11px;
}

.assureo-chat-welcome-copy img {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.assureo-chat-welcome-copy p {
  margin: 0;
  color: var(--assureo-navy);
  font-size: 13px;
  font-weight: 700;
}

.assureo-chat-welcome-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.assureo-chat-button {
  min-height: 42px;
  padding: 0 12px;
  font-size: 12px;
}

.assureo-chat-button--dark {
  background: var(--assureo-navy-deep);
  color: var(--assureo-white);
}

.assureo-chat-button--red {
  background: var(--assureo-red);
  color: var(--assureo-white);
}

.assureo-chat-launcher {
  display: block;
  width: 78px;
  height: 70px;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.assureo-chat-launcher--mobile {
  display: none;
}

.assureo-chat-launcher img {
  display: block;
  width: 100%;
  height: auto;
}

.assureo-chat-window {
  overflow: hidden;
  margin-bottom: 15px;
}

.assureo-chat-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 43px 0 18px;
  background: var(--assureo-navy-deep);
  color: var(--assureo-white);
  font-size: 12px;
}

.assureo-chat-header strong {
  font-size: 14px;
}

.assureo-chat-header span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
}

.assureo-chat-header i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4be313;
}

.assureo-chat-body {
  display: flex;
  flex-direction: column;
  gap: 11px;
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 18px 15px;
  background: var(--assureo-white);
  border-radius: 0 0 22px 22px;
}

.assureo-chat-body::-webkit-scrollbar {
  display: none;
}

.assureo-chat-message {
  display: flex;
  align-items: flex-end;
  max-width: 100%;
  padding: 0;
  border-radius: 0;
  font-size: 13px;
  line-height: 1.3;
}

.assureo-chat-message--bot {
  align-self: flex-start;
  color: var(--assureo-navy);
}

.assureo-chat-message-avatar {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  margin-right: 9px;
  border-radius: 50%;
  object-fit: cover;
}

.assureo-chat-message-content {
  max-width: calc(100% - 47px);
  padding: 11px 13px;
  border-radius: 14px;
  background: #f0f4f8;
}

.assureo-chat-message--user {
  align-self: flex-end;
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 14px;
  background: var(--assureo-navy-deep);
  color: var(--assureo-white);
}

.assureo-chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 64px;
  min-height: 38px;
}

.assureo-chat-typing span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9aaabe;
  animation: assureo-chat-bounce 1s ease-in-out infinite;
}

.assureo-chat-typing span:nth-child(2) {
  animation-delay: .12s;
}

.assureo-chat-typing span:nth-child(3) {
  animation-delay: .24s;
}

@keyframes assureo-chat-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-5px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .assureo-chat-typing span {
    animation: none;
  }
}

.assureo-chat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.assureo-chat-option {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--assureo-border);
  border-radius: 999px;
  background: var(--assureo-white);
  color: var(--assureo-navy);
  font-size: 11px;
  font-weight: 700;
}

.assureo-chat-option:hover {
  border-color: var(--assureo-red);
  color: var(--assureo-red);
}

.assureo-chat-option--primary {
  border-color: var(--assureo-red);
  background: var(--assureo-red);
  color: var(--assureo-white);
}

.assureo-chat-option--primary:hover {
  border-color: var(--assureo-red);
  color: var(--assureo-white);
}

.assureo-chat-option:disabled {
  cursor: default;
  opacity: .72;
}

.assureo-chat-support-form,
.assureo-chat-name-form,
.assureo-chat-email-form,
.assureo-chat-phone-form,
.assureo-chat-field-form,
.assureo-chat-privacy-form,
.assureo-chat-optional-consent-form {
  padding: 0 15px 15px;
  background: var(--assureo-white);
  border-radius: 0 0 22px 22px;
}

.assureo-chatbot.is-open .assureo-chat-privacy-form:not([hidden]) {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  min-height: 0;
}

.assureo-chatbot.is-open .assureo-chat-optional-consent-form:not([hidden]) {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  min-height: 0;
}

.assureo-chat-support-form label,
.assureo-chat-name-form label,
.assureo-chat-email-form label,
.assureo-chat-phone-form label,
.assureo-chat-field-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
}

.assureo-chat-field-form label[hidden] {
  display: none;
}

.assureo-chat-support-form textarea,
.assureo-chat-name-form input,
.assureo-chat-email-form input,
.assureo-chat-phone-form input,
.assureo-chat-field-form input,
.assureo-chat-field-form select {
  display: block;
  width: 100%;
  padding: 9px;
  border: 1px solid var(--assureo-border);
  border-radius: 10px;
  color: var(--assureo-navy);
}

.assureo-chat-email-form input[aria-invalid="true"],
.assureo-chat-name-form input[aria-invalid="true"],
.assureo-chat-phone-form input[aria-invalid="true"],
.assureo-chat-field-form input[aria-invalid="true"],
.assureo-chat-field-form select[aria-invalid="true"] {
  border-color: var(--assureo-red);
  box-shadow: 0 0 0 3px rgba(226, 29, 42, .12);
}

.assureo-chat-field-form input[hidden],
.assureo-chat-field-form select[hidden] {
  display: none;
}

.assureo-chat-date-fields[hidden] {
  display: none;
}

.assureo-chat-date-hint {
  margin: 0 0 12px;
  color: var(--assureo-muted);
  font-size: 12px;
}

.assureo-chat-date-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.assureo-chat-date-field {
  position: relative;
  min-width: 0;
}

.assureo-chat-date-field::after {
  position: absolute;
  right: 13px;
  bottom: 18px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--assureo-navy);
  border-bottom: 2px solid var(--assureo-navy);
  content: '';
  pointer-events: none;
  transform: rotate(45deg);
}

.assureo-chat-field-form .assureo-chat-date-field select {
  min-height: 45px;
  padding: 9px 30px 9px 10px;
  background: var(--assureo-white);
  appearance: none;
}

.assureo-chat-field-form .assureo-places-host gmp-place-autocomplete {
  display: block;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--assureo-border);
  border-radius: 10px;
  font-size: 14px;
}

.assureo-chat-address-city {
  margin: 8px 0 0;
  color: var(--assureo-navy);
  font-size: 12px;
}

.assureo-chat-manual-address {
  display: grid;
  gap: 6px;
}

.assureo-chat-manual-address label:not(:first-of-type) {
  margin-top: 5px;
}

.assureo-chat-form-error {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--assureo-red);
  font-size: 12px;
  line-height: 1.3;
}

.assureo-chat-support-form textarea {
  resize: vertical;
}

.assureo-chat-support-form .assureo-chat-button,
.assureo-chat-name-form .assureo-chat-button,
.assureo-chat-email-form .assureo-chat-button,
.assureo-chat-phone-form .assureo-chat-button,
.assureo-chat-field-form .assureo-chat-button {
  display: block;
  margin: 9px auto 0;
  padding: 0 25px;
}

.assureo-chat-message-content .assureo-chat-privacy-link {
  color: inherit;
  text-decoration: underline;
}

.assureo-chat-privacy-phrase {
  white-space: nowrap;
}

.assureo-chat-privacy-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
  flex: 0 0 auto;
}

.assureo-chat-privacy-option {
  position: relative;
  display: block;
  margin: 0;
  cursor: pointer;
}

.assureo-chat-privacy-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.assureo-chat-privacy-option span {
  display: block;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--assureo-border);
  border-radius: 10px;
  color: var(--assureo-navy);
  font-size: 12px;
  line-height: 1.4;
}

.assureo-chat-privacy-option input:checked + span {
  border-color: var(--assureo-navy);
  background: #f1f5ff;
}

.assureo-chat-privacy-option input:checked + span a {
  color: inherit;
}

.assureo-chat-privacy-option input:focus-visible + span,
.assureo-chat-privacy-option:hover span {
  border-color: var(--assureo-navy);
}

.assureo-chat-optional-consents {
  display: grid;
  flex: 1 1 auto;
  gap: 0;
  max-height: 230px;
  min-height: 0;
  margin-top: 8px;
  overflow-y: auto;
  border-top: 1px solid var(--assureo-border);
}

.assureo-chat-optional-consents[hidden] {
  display: none;
}

.assureo-chat-optional-consent {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--assureo-border);
  color: var(--assureo-navy);
  cursor: pointer;
}

.assureo-chat-optional-consent input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--assureo-navy);
}

.assureo-chat-optional-consent > span {
  display: grid;
  gap: 4px;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
}

.assureo-chat-optional-consent strong {
  font-size: 11px;
  font-weight: 600;
}

.assureo-chat-optional-consent small,
.assureo-chat-optional-consent a {
  color: var(--assureo-muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 400;
}

.assureo-chat-optional-consent em {
  padding: 4px 6px;
  border-radius: 7px;
  background: #f0f3f7;
  color: var(--assureo-muted);
  font-size: 9px;
  font-style: normal;
  white-space: nowrap;
}

.assureo-chat-consent-submit {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  margin-top: 10px;
}

.assureo-chat-consent-question {
  flex: 0 0 auto;
  margin: 0 0 8px;
  color: var(--assureo-navy);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.assureo-chat-consent-error {
  margin: 6px 0;
}

.assureo-chat-completion {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 15px 25px;
  background: var(--assureo-white);
  border-radius: 0 0 22px 22px;
  text-align: center;
}

.assureo-chat-completion-avatar {
  display: block;
  width: 96px;
  height: 96px;
  margin-bottom: 16px;
  border-radius: 50%;
  object-fit: cover;
}

.assureo-chat-completion-message {
  width: 100%;
  padding: 17px 15px;
  border: 1px solid var(--assureo-navy);
  border-radius: 16px;
  background: #1644b81f;
  color: var(--assureo-navy-deep);
  font-size: 13px;
  line-height: 1.4;
}

.assureo-chat-completion-submit {
  min-width: 210px;
  margin-top: 16px;
}

@media (max-width: 992px) {
  .assureo-landing .assureo-chat-launcher:not(.assureo-chat-launcher--mobile) {
    display: none;
  }

  .assureo-landing .assureo-chat-launcher--mobile {
    position: fixed;
    z-index: 1002;
    right: auto;
    bottom: 120px;
    left: 20px;
    margin: 0;
    display: block;
  }

  .assureo-landing .assureo-chat-welcome {
    position: fixed;
    z-index: 1001;
    bottom: 20px;
    left: 20px;
    margin-left: 0;
    margin-top: 0;
  }
}

@media (max-width: 600px) {
  .assureo-chatbot {
      top: 12px;
      left: auto;
      right: 12px;
      bottom: auto;
      width: min(340px, calc(100vw - 24px));
    }

  .assureo-landing .assureo-chatbot {
      position: relative;
      top: auto;
      right: auto;
      bottom: auto;
      left: auto;
      width: min(340px, calc(100vw - 24px));
    }

  .assureo-chatbot.is-open {
      padding: 12px;
    }

  .assureo-chatbot.is-open .assureo-chat-window {
      width: min(360px, calc(100vw - 24px));
      max-height: calc(100vh - 24px);
      max-height: calc(100dvh - 24px);
    }

  .assureo-landing .assureo-chat-welcome {
      left: 12px;
      right: 12px;
      width: auto;
      max-width: none;
      margin-left: 0;
      padding: 16px 14px 14px;
      transform: none;
    }

  .assureo-landing .assureo-chat-welcome-copy {
      display: flex;
      min-width: 0;
    }

  .assureo-landing .assureo-chat-welcome-copy img {
      display: none;
    }

  .assureo-landing .assureo-chat-welcome-actions {
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-top: 16px;
    }

  .assureo-landing .assureo-chat-launcher {
      position: absolute;
      bottom: 100px;
      left: 0;
      margin: 0;
    }

  .assureo-landing .assureo-chat-launcher--mobile {
      position: fixed;
      right: auto;
      bottom: 120px;
      left: 20px;
    }

  .assureo-chat-welcome {
      padding: 16px 14px 14px;
    }

  .assureo-chat-welcome-copy p,
  .assureo-chat-button {
      min-width: 0;
    }

  .assureo-chat-welcome-copy p {
      overflow-wrap: anywhere;
    }

  .assureo-chat-launcher {
      width: 68px;
      height: 60px;
    }
}

@media (min-width: 325px) and (max-width: 600px) {
  .assureo-landing .assureo-chat-welcome {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    transform: none;
  }
}


.assureo-chat-button:focus-visible,
.assureo-chat-launcher:focus-visible {
  outline: 3px solid rgba(226, 29, 42, .3);
  outline-offset: 3px;
}

.assureo-chat-button {
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  line-height: 1;
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.assureo-chat-button:hover {
  transform: translateY(-2px);
}
