﻿.waia-chat-wrap,
.waia-floating {
  --waia-accent: #0f5b99;
  --waia-window-width: 380px;
  --waia-window-height: 560px;
  --waia-radius: 8px;
  font: inherit;
}

.waia-floating {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  box-sizing: border-box;
}

.waia-floating__panel {
  display: none;
  width: min(var(--waia-window-width), calc(100vw - 32px));
  height: min(var(--waia-window-height), calc(100vh - 112px));
  margin-bottom: 12px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
  box-sizing: border-box;
}

.waia-floating.is-open .waia-floating__panel {
  display: block;
}

.waia-floating__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  min-height: 64px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: var(--waia-accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
  text-decoration: none;
  appearance: none;
  box-sizing: border-box;
}

.waia-floating__icon {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: transparent;
  color: #fff;
}

.waia-floating__svg {
  display: block;
  width: 46px;
  height: 46px;
}

.waia-floating .screen-reader-text,
.waia-chat .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.waia-chat {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 360px;
  border: 1px solid #d8dee8;
  border-radius: var(--waia-radius);
  background: #fff;
  color: #172033;
  font: inherit;
  overflow: hidden;
  box-sizing: border-box;
}

.waia-chat *,
.waia-chat *::before,
.waia-chat *::after,
.waia-floating *,
.waia-floating *::before,
.waia-floating *::after {
  box-sizing: border-box;
}

.waia-chat-wrap .waia-chat {
  max-width: 760px;
  height: auto;
}

.waia-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
  background: var(--waia-accent);
  color: #fff;
}

.waia-chat__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.waia-chat__header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.waia-chat__clear {
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  appearance: none;
}

.waia-chat__close {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  appearance: none;
}

.waia-chat__messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  min-height: 260px;
  overflow-y: auto;
  padding: 16px;
  background: #f6f8fb;
  margin: 0;
}

.waia-chat__message {
  display: inline-block;
  width: auto;
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.45;
  white-space: pre-line;
  text-align: left;
  margin: 0;
}

.waia-chat__message,
.waia-chat__message * {
  text-align: left !important;
}

.waia-chat__message--assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e1e6ef;
  margin-right: auto;
  margin-left: 0;
  text-align: left;
}

.waia-chat__message--user {
  align-self: flex-end;
  background: var(--waia-accent);
  color: #fff;
  margin-left: auto;
  text-align: left;
}

.waia-chat__inline-link {
  color: var(--waia-accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.waia-chat__inline-link:hover,
.waia-chat__inline-link:focus {
  text-decoration-thickness: 2px;
}

.waia-chat__form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid #d8dee8;
  background: #fff;
  margin: 0;
}

.waia-chat__input {
  flex: 1;
  min-height: 48px;
  resize: vertical;
  border: 1px solid #c9d3df;
  border-radius: 6px;
  padding: 10px;
  font: inherit;
  width: auto;
  margin: 0;
}

.waia-chat__button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: var(--waia-accent);
  color: #fff;
  cursor: pointer;
  min-width: 56px;
  margin: 0;
  appearance: none;
}

.waia-chat__send-icon,
.waia-chat__send-svg {
  display: block;
  width: 24px;
  height: 24px;
}

.waia-chat__button:hover,
.waia-chat__button:focus,
.waia-chat__clear:hover,
.waia-chat__clear:focus,
.waia-floating__button:hover,
.waia-floating__button:focus {
  filter: brightness(0.92);
}

.waia-chat__sources {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e1e6ef;
  font-size: 13px;
}

.waia-chat__source {
  color: var(--waia-accent);
  text-decoration: none;
}

a.waia-chat__source:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .waia-floating {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .waia-floating__panel {
    width: 100%;
  }

  .waia-floating__button {
    margin-left: auto;
  }

  .waia-chat__form {
    flex-direction: column;
  }

  .waia-chat__button {
    align-self: flex-end;
    min-height: 56px;
  }

  .waia-chat__message {
    max-width: 100%;
  }
}
