.aipe-chat {
  --aipe-chat-glass-bg: #f5fafc;
  --aipe-chat-glass-border: #ffffff;
  --aipe-chat-shadow: 0 18px 45px rgba(31, 54, 73, 0.24);
  --aipe-chat-accent: #1a6f8e;
  --aipe-chat-accent-hover: #155870;
  --aipe-chat-user-bg: #1a6f8e;
  --aipe-chat-user-text: #f2fbff;
  --aipe-chat-bot-bg: #eef4f7;
  --aipe-chat-bot-text: #1f3b4d;
  --aipe-chat-meta-color: rgba(31, 59, 77, 0.72);
  --aipe-chat-day-bg: rgba(255, 255, 255, 0.58);
  --aipe-chat-day-border: rgba(255, 255, 255, 0.7);
  --aipe-chat-day-text: rgba(31, 59, 77, 0.68);
  --aipe-chat-close-bg: rgba(255, 255, 255, 0.55);
  --aipe-chat-close-border: rgba(255, 255, 255, 0.65);
  --aipe-chat-close-text: #22485c;
  --aipe-chat-input-bg: rgba(255, 255, 255, 0.73);
  --aipe-chat-overlay-tint:
    linear-gradient(135deg, rgba(176, 220, 233, 0.35), rgba(255, 222, 180, 0.28));
  --aipe-chat-conversation-bg: transparent;
  --aipe-chat-overlay-blur: 15px;
  --aipe-chat-composer-blur: 14px;
  --aipe-chat-conversation-bottom-space: 200px;
  --aipe-chat-composer-width: 900px;
  --aipe-chat-composer-padding: 14px;
  --aipe-chat-composer-bottom: 16px;
  --aipe-chat-composer-radius: 21px;
  --aipe-chat-input-radius: 15px;
  --aipe-chat-bubble-radius: 18px;
  --aipe-chat-send-radius: 11px;
  --aipe-chat-send-pad-y: 10px;
  --aipe-chat-send-pad-x: 15px;
  --aipe-chat-composer-border-width: 1px;
  --aipe-chat-avatar-size: 30px;
  --aipe-chat-quick-gap: 7px;
  --aipe-chat-quick-pad-y: 7px;
  --aipe-chat-quick-pad-x: 13px;
  --aipe-chat-row-gap: 9px;
  --aipe-chat-font: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  --aipe-chat-message-font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  --aipe-chat-message-font-size: 15px;
  --aipe-chat-message-line-height: 1.45;
  --aipe-chat-message-weight: 400;
  --aipe-chat-meta-font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  --aipe-chat-meta-font-size: 11px;
  --aipe-chat-meta-line-height: 1.2;
  --aipe-chat-meta-weight: 500;
  --aipe-chat-input-font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  --aipe-chat-input-font-size: 16px;
  --aipe-chat-input-line-height: 1.4;
  --aipe-chat-input-weight: 400;
  --aipe-chat-entry-duration: 420ms;
  --aipe-chat-top-offset: 0px;

  font-family: var(--aipe-chat-font);
}

.aipe-chat,
.aipe-chat *,
.aipe-chat *::before,
.aipe-chat *::after {
  box-sizing: border-box !important;
}

.aipe-chat button,
.aipe-chat textarea {
  font-family: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
  letter-spacing: normal !important;
  text-transform: none !important;
}

.aipe-chat .aipe-chat__send,
.aipe-chat .aipe-chat__quick-reply,
.aipe-chat .aipe-chat__close {
  appearance: none !important;
  -webkit-appearance: none !important;
  outline: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
  background-image: none !important;
  background-clip: padding-box !important;
  text-decoration: none !important;
  cursor: pointer !important;
  -webkit-tap-highlight-color: transparent;
}

.aipe-chat .aipe-chat__send::before,
.aipe-chat .aipe-chat__send::after,
.aipe-chat .aipe-chat__quick-reply::before,
.aipe-chat .aipe-chat__quick-reply::after,
.aipe-chat .aipe-chat__close::after {
  content: none !important;
  display: none !important;
}

.aipe-chat__overlay {
  position: fixed;
  inset: var(--aipe-chat-top-offset) 0 0 0;
  z-index: 2147483000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  background: var(--aipe-chat-overlay-tint);
  backdrop-filter: blur(var(--aipe-chat-overlay-blur)) saturate(130%);
  -webkit-backdrop-filter: blur(var(--aipe-chat-overlay-blur)) saturate(130%);
}

.aipe-chat--open .aipe-chat__overlay {
  opacity: 1;
  pointer-events: auto;
}

.aipe-chat__conversation {
  width: min(900px, calc(100vw - 2rem));
  height: calc(100vh - 3rem - var(--aipe-chat-top-offset));
  height: calc(100dvh - 3rem - var(--aipe-chat-top-offset));
  max-height: calc(100vh - 3rem - var(--aipe-chat-top-offset));
  max-height: calc(100dvh - 3rem - var(--aipe-chat-top-offset));
  margin: 3rem auto 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0.35rem var(--aipe-chat-conversation-bottom-space);
  background: var(--aipe-chat-conversation-bg);
  border-radius: calc(var(--aipe-chat-composer-radius) * 0.75);
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.aipe-chat__conversation::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.aipe-chat .aipe-chat__close {
  position: fixed;
  top: calc(var(--aipe-chat-top-offset) + 0.9rem);
  right: 0.9rem;
  z-index: 2;
  width: 2.2rem !important;
  height: 2.2rem !important;
  border-radius: 999px !important;
  border: 0 !important;
  background: var(--aipe-chat-close-bg) !important;
  font-size: 1.45rem !important;
  line-height: 1 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: none;
}

.aipe-chat .aipe-chat__close::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--aipe-chat-close-border);
  pointer-events: none;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.aipe-chat .aipe-chat__close-label {
  color: var(--aipe-chat-close-text) !important;
}

.aipe-chat .aipe-chat__close:active {
  transform: none;
  filter: none;
}

.aipe-chat .aipe-chat__close:hover,
.aipe-chat .aipe-chat__close:focus,
.aipe-chat .aipe-chat__close:focus-visible {
  background: var(--aipe-chat-close-bg) !important;
  filter: none !important;
  transform: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.aipe-chat__bubble {
  max-width: 100%;
  border-radius: var(--aipe-chat-bubble-radius);
  padding: 0.85rem 1rem;
  line-height: 1.45;
  box-shadow: none;
  background-clip: padding-box;
  animation: aipe-chat-slide-in 180ms ease;
}

.aipe-chat__item {
  max-width: min(74ch, 92%);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: transparent;
}

.aipe-chat__item--assistant {
  align-self: flex-start;
}

.aipe-chat__item--user {
  align-self: flex-end;
}

.aipe-chat__row {
  display: flex;
  align-items: flex-end;
  gap: var(--aipe-chat-row-gap);
  background: transparent;
}

.aipe-chat__row--assistant {
  align-self: flex-start;
}

.aipe-chat__row--user {
  align-self: flex-end;
  justify-content: flex-end;
}

.aipe-chat__avatar {
  width: var(--aipe-chat-avatar-size);
  height: var(--aipe-chat-avatar-size);
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.aipe-chat__meta {
  font-family: var(--aipe-chat-meta-font-family, var(--aipe-chat-font));
  font-size: var(--aipe-chat-meta-font-size);
  font-weight: var(--aipe-chat-meta-weight);
  line-height: var(--aipe-chat-meta-line-height);
  color: var(--aipe-chat-meta-color);
}

.aipe-chat__meta--assistant {
  padding-left: 2.15rem;
}

.aipe-chat__meta--user {
  text-align: right;
  padding-right: 0.25rem;
}

.aipe-chat__day-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.2rem 0 0.45rem;
}

.aipe-chat__day-separator > span {
  position: relative;
  font-size: 0.72rem;
  background: var(--aipe-chat-day-bg);
  border: 0;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  overflow: hidden;
}

.aipe-chat__day-separator > span::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--aipe-chat-day-border);
  pointer-events: none;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.aipe-chat__day-label {
  display: inline;
  position: relative;
  z-index: 1;
  color: var(--aipe-chat-day-text);
}

.aipe-chat__bubble--user {
  background: var(--aipe-chat-user-bg);
  border-bottom-right-radius: 0.4rem;
}

.aipe-chat__bubble--assistant {
  background: var(--aipe-chat-bot-bg);
  border-bottom-left-radius: 0.4rem;
}

.aipe-chat__bubble-content {
  display: inline;
  font-family: var(--aipe-chat-message-font-family, var(--aipe-chat-font));
  font-size: var(--aipe-chat-message-font-size);
  font-weight: var(--aipe-chat-message-weight);
  line-height: var(--aipe-chat-message-line-height);
}

.aipe-chat__bubble--user .aipe-chat__bubble-content {
  color: var(--aipe-chat-user-text);
}

.aipe-chat__bubble--assistant .aipe-chat__bubble-content {
  color: var(--aipe-chat-bot-text);
}

@supports ((-webkit-background-clip: text) and (-webkit-text-fill-color: transparent)) {
  .aipe-chat__meta {
    background: var(--aipe-chat-meta-color);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }

  .aipe-chat__bubble--user .aipe-chat__bubble-content {
    background: var(--aipe-chat-user-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }

  .aipe-chat__bubble--assistant .aipe-chat__bubble-content {
    background: var(--aipe-chat-bot-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }

  .aipe-chat__close-label {
    background: var(--aipe-chat-close-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }

  .aipe-chat__day-label {
    background: var(--aipe-chat-day-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
}

.aipe-chat__empty {
  align-self: center;
  color: rgba(31, 59, 77, 0.75);
  background: rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
}

.aipe-chat__composer {
  position: fixed;
  left: 50%;
  bottom: var(--aipe-chat-composer-bottom);
  transform: translateX(-50%);
  width: min(var(--aipe-chat-composer-width), calc(100vw - 1.25rem));
  z-index: 2147483600;
  padding: var(--aipe-chat-composer-padding);
  border-radius: var(--aipe-chat-composer-radius);
  border: 0;
  background: var(--aipe-chat-glass-bg);
  backdrop-filter: blur(var(--aipe-chat-composer-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--aipe-chat-composer-blur)) saturate(140%);
  box-shadow: var(--aipe-chat-shadow);
  transition: opacity 240ms ease, translate 260ms ease;
}

.aipe-chat[data-entry-animation="fade-up"] .aipe-chat__composer {
  animation: aipe-chat-composer-fade-up var(--aipe-chat-entry-duration) cubic-bezier(0.17, 0.89, 0.32, 1.08) both;
}

.aipe-chat[data-entry-animation="slide-up"] .aipe-chat__composer {
  animation: aipe-chat-composer-slide-up var(--aipe-chat-entry-duration) cubic-bezier(0.16, 0.84, 0.34, 1) both;
}

.aipe-chat[data-entry-animation="pop"] .aipe-chat__composer {
  animation: aipe-chat-composer-pop var(--aipe-chat-entry-duration) cubic-bezier(0.17, 0.9, 0.32, 1.2) both;
}

.aipe-chat--composer-hidden .aipe-chat__composer {
  opacity: 0;
  pointer-events: none;
  translate: 0 125%;
}

.aipe-chat__composer::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: var(--aipe-chat-composer-border-width);
  background: var(--aipe-chat-glass-border);
  pointer-events: none;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.aipe-chat__form {
  display: block;
}

.aipe-chat__field {
  position: relative;
  display: block;
}

.aipe-chat__field textarea {
  display: block;
  width: 100%;
  min-height: 56px;
  max-height: 140px;
  resize: none;
  border-radius: var(--aipe-chat-input-radius);
  border: 1px solid rgba(24, 89, 111, 0.15);
  background: var(--aipe-chat-input-bg);
  color: #203644;
  padding: 0.9rem 8rem 0.9rem 1rem;
  font-family: var(--aipe-chat-input-font-family, var(--aipe-chat-font));
  font-size: var(--aipe-chat-input-font-size);
  font-weight: var(--aipe-chat-input-weight);
  line-height: var(--aipe-chat-input-line-height);
  overflow-y: hidden;
  outline: none;
}

.aipe-chat__field textarea::placeholder {
  font-family: var(--aipe-chat-input-font-family, var(--aipe-chat-font));
  font-size: var(--aipe-chat-input-font-size);
  font-weight: var(--aipe-chat-input-weight);
  line-height: var(--aipe-chat-input-line-height);
}

.aipe-chat__field textarea:focus {
  border-color: rgba(26, 111, 142, 0.6);
  box-shadow: 0 0 0 3px rgba(26, 111, 142, 0.14);
}

.aipe-chat .aipe-chat__send {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0 !important;
  border-radius: var(--aipe-chat-send-radius) !important;
  background: var(--aipe-chat-accent) !important;
  color: #ecfbff !important;
  margin: 0 !important;
  padding: var(--aipe-chat-send-pad-y) var(--aipe-chat-send-pad-x) !important;
  font-weight: 600 !important;
  font-size: 0.92rem !important;
  transition: none;
}

.aipe-chat .aipe-chat__send:active {
  transform: translateY(-50%);
}

.aipe-chat .aipe-chat__send:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.aipe-chat__quick-replies {
  margin-top: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: var(--aipe-chat-quick-gap);
}

.aipe-chat .aipe-chat__quick-reply {
  border: 1px solid rgba(26, 111, 142, 0.22) !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.62) !important;
  color: #245067 !important;
  margin: 0 !important;
  padding: var(--aipe-chat-quick-pad-y) var(--aipe-chat-quick-pad-x) !important;
  font-size: 0.84rem !important;
  line-height: 1.15 !important;
  transition: none;
}

.aipe-chat .aipe-chat__send:hover,
.aipe-chat .aipe-chat__send:focus,
.aipe-chat .aipe-chat__send:focus-visible {
  background: var(--aipe-chat-accent) !important;
  color: #ecfbff !important;
  transform: translateY(-50%) !important;
  outline: none !important;
  box-shadow: none !important;
}

.aipe-chat .aipe-chat__quick-reply:hover,
.aipe-chat .aipe-chat__quick-reply:focus,
.aipe-chat .aipe-chat__quick-reply:focus-visible {
  background: rgba(255, 255, 255, 0.62) !important;
  border-color: rgba(26, 111, 142, 0.22) !important;
  color: #245067 !important;
  outline: none !important;
  box-shadow: none !important;
}

.aipe-chat__status {
  margin: 0.5rem 0 0;
  color: #7f2732;
  font-size: 0.8rem;
}

.aipe-chat__status:empty {
  display: none;
}

@keyframes aipe-chat-slide-in {
  from {
    transform: translateY(6px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes aipe-chat-composer-fade-up {
  from {
    opacity: 0;
    translate: 0 18px;
  }

  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes aipe-chat-composer-slide-up {
  from {
    opacity: 0;
    translate: 0 56px;
  }

  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes aipe-chat-composer-pop {
  from {
    opacity: 0;
    scale: 0.93;
  }

  to {
    opacity: 1;
    scale: 1;
  }
}

@media (max-width: 768px) {
  .aipe-chat__conversation {
    margin-top: 1.15rem;
    margin-bottom: 0;
    width: calc(100vw - 0.95rem);
    height: calc(100vh - 1.15rem - var(--aipe-chat-top-offset));
    height: calc(100dvh - 1.15rem - var(--aipe-chat-top-offset));
    max-height: calc(100vh - 1.15rem - var(--aipe-chat-top-offset));
    max-height: calc(100dvh - 1.15rem - var(--aipe-chat-top-offset));
  }

  .aipe-chat__close {
    top: calc(var(--aipe-chat-top-offset) + 0.55rem);
    right: 0.55rem;
  }

  .aipe-chat__composer {
    width: calc(100vw - 0.75rem);
    bottom: 0.35rem;
    border-radius: 1rem;
    padding: 0.65rem;
  }

  .aipe-chat__field textarea {
    min-height: 52px;
    padding-right: 7rem;
  }

  .aipe-chat .aipe-chat__send {
    padding: var(--aipe-chat-send-pad-y) var(--aipe-chat-send-pad-x) !important;
  }
}

body.admin-bar .aipe-chat {
  --aipe-chat-top-offset: 32px;
}

@media (max-width: 782px) {
  body.admin-bar .aipe-chat {
    --aipe-chat-top-offset: 46px;
  }
}
