#bix-ia-chat {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99999;
  font-family: var(--bix-ia-font);
  color: var(--bix-ia-text);
  font-weight: 400;
}

#bix-ia-chat-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: var(--bix-ia-primary);
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

#bix-ia-chat-button:hover,
#bix-ia-chat-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

#bix-ia-chat-button:focus-visible,
#bix-ia-close:focus-visible,
.bix-ia-form button:focus-visible,
#bix-ia-input:focus-visible {
  outline: 2px solid var(--bix-ia-primary);
  outline-offset: 3px;
}

#bix-ia-window {
  width: 340px;
  max-width: calc(100vw - 32px);
  margin-bottom: 16px;
  background: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.22);
}

.bix-ia-hidden {
  display: none;
}

.bix-ia-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: var(--bix-ia-primary);
  color: var(--bix-ia-header-text);
}

.bix-ia-header-content {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bix-ia-logo {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  object-fit: contain;
  padding: 2px;
  background: #ffffff;
  border-radius: 50%;
}

.bix-ia-title {
  font-weight: 600;
  line-height: 1.25;
}

#bix-ia-close {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--bix-ia-header-text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.bix-ia-messages {
  height: 260px;
  padding: 16px;
  overflow-y: auto;
  background: var(--bix-ia-secondary);
}

.bix-ia-message {
  max-width: 85%;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.bix-ia-bot {
  background: #ffffff;
  color: var(--bix-ia-text);
}

.bix-ia-user {
  margin-left: auto;
  background: color-mix(in srgb, var(--bix-ia-primary) 10%, white);
  color: var(--bix-ia-text);
}

.bix-ia-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #ffffff;
}

#bix-ia-input {
  flex: 1;
  min-width: 0;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
}

.bix-ia-form button {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bix-ia-primary);
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
}

.bix-ia-sources {
  max-width: 85%;
  margin: -4px 0 12px 0;
  padding: 8px 10px;
  background: #ffffff;
  border-left: 1px solid var(--bix-ia-primary);
  border-radius: 10px;
  font-size: 12px;
  font-style: italic;
}

.bix-ia-sources-title {
  margin-bottom: 4px;
  font-weight: 600;
}

.bix-ia-sources a {
  display: block;
  margin-bottom: 3px;
  color: var(--bix-ia-link);
  text-decoration: underline;
}

.bix-ia-loading {
  display: flex;
  gap: 4px;
  align-items: center;
  width: fit-content;
}

.bix-ia-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.3;
  animation: bixIaBounce 1.2s infinite ease-in-out;
}

.bix-ia-loading span:nth-child(2) {
  animation-delay: 0.2s;
}

.bix-ia-loading span:nth-child(3) {
  animation-delay: 0.4s;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#bix-ia-chat-button {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 64px;
  height: 64px;

  border: 0;
  border-radius: 50%;

  background: var(--bix-ia-icon-bg);
  color: var(--bix-ia-icon-color);

  font-size: 28px;

  cursor: pointer;

  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

#bix-ia-chat-button svg {
  width: 32px;
  height: 32px;

  fill: currentColor;

  display: block;
}

@keyframes bixIaBounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.3;
  }

  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

@media (max-width: 480px) {
  #bix-ia-chat {
    right: 16px;
    bottom: 16px;
    left: 16px;
  }

  #bix-ia-window {
    width: 100%;
    max-width: none;
  }

  #bix-ia-chat-button {
    margin-left: auto;
  }

  .bix-ia-messages {
    height: 320px;
    max-height: 55vh;
  }
}
