.loading-animation {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  margin-top: 10px;
}

.loading-animation .dot {
  width: 8px;
  height: 8px;
  margin: 0 5px;
  background-color: var(--biel-loading-dot-color);
  border-radius: 50%;
  animation: bounce 1.2s infinite ease-in-out;
}

.loading-animation .dot:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-animation .dot:nth-child(2) {
  animation-delay: -0.16s;
}

.loading-animation .dot:nth-child(3) {
  animation-delay: 0s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}


:host {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.biel-chat-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  /* The chat pins its own scroll position; browser scroll anchoring fights
     the per-chunk re-render during streaming and fires spurious scroll
     events that read as the user scrolling up. */
  overflow-anchor: none;
  padding: 10px 10px 16px;
  gap: 16px;
  transition: all 0.3s ease-in-out;
}

.biel-chat-container--embedded {
  min-height: var(--biel-chat-embedded-height);
}

.biel-answer {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.biel-continue-button-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 10px;
}

.biel-chat-container::-webkit-scrollbar {
  width: 6px;
}

.biel-chat-container::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 10px;
  border: 3px solid transparent;
  transition: background-color 0.3s ease;
}

/* Show scrollbar only while user is scrolling */
.biel-chat-container.is-scrolling::-webkit-scrollbar-thumb {
  background-color: var(--biel-chat-scrollbar-color);
}

.biel-chat-container.is-scrolling::-webkit-scrollbar-thumb:hover {
  background-color: var(--biel-chat-scrollbar-hover-color);
}

/* Keep it hidden while AI is streaming */
.biel-chat-container.is-streaming::-webkit-scrollbar,
.biel-chat-container.is-streaming::-webkit-scrollbar-thumb {
  background-color: transparent;
}

.biel-incomplete {
  margin: 6px 4px 16px;
  font-size: var(--biel-text-sm-font-size, 12px);
  line-height: 1.6;
  color: var(--biel-activity-text-color, var(--biel-text-color));
}

.biel-activity {
  color: var(--biel-activity-text-color, var(--biel-text-color));
  font-family: inherit;
  font-size: var(--biel-text-sm-font-size, 12px);
  line-height: 1.6;
  padding: 0 4px;
}

.biel-activity-current {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
}

.biel-activity-label {
  animation: activity-reveal 300ms ease-out both;
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .biel-activity-label--busy {
    background-image: linear-gradient(
      100deg,
      currentColor 40%,
      var(--biel-message-biel-text-color, currentColor) 50%,
      currentColor 60%
    );
    background-size: 250% 100%;
    background-position: 100% 0;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation:
      activity-reveal 300ms ease-out both,
      activity-shimmer 2s linear infinite;
  }
}

@keyframes activity-shimmer {
  to {
    background-position: -100% 0;
  }
}

@keyframes activity-reveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.biel-activity-mark {
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  color: var(--biel-activity-accent-color, var(--biel-footer-action-copied-color));
  font-size: 12px;
}

.biel-activity-mark--busy {
  border: 1.5px solid var(--biel-activity-border-color, var(--biel-border-color));
  border-top-color: var(
    --biel-activity-spinner-color,
    var(--biel-activity-accent-color, var(--biel-primary-color))
  );
  border-radius: 50%;
  animation: activity-turn 1.2s linear infinite;
}

.biel-activity-mark svg {
  display: block;
  flex-shrink: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.biel-retry-button,
.biel-continue-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: var(--biel-font-family);
  font-size: var(--biel-input-options-font-size, 12px);
  line-height: 1.5;
  background-color: var(--biel-bot-content-bg-color);
  color: var(--biel-input-color);
  border: 1px solid var(--biel-input-border-color);
  border-radius: var(--biel-radius-sm);
  padding: 4px 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.biel-retry-button svg,
.biel-continue-button svg {
  display: block;
  flex-shrink: 0;
}

@media (hover: hover) {
  .biel-retry-button:not(:disabled):hover,
  .biel-continue-button:not(:disabled):hover {
    background-color: var(--biel-input-options-button-hover-bg-color);
    border-color: var(--biel-input-options-button-hover-border-color);
  }
}

.biel-retry-button:not(:disabled):focus-visible,
.biel-continue-button:not(:disabled):focus-visible {
  outline: none;
  border-color: var(--biel-input-options-button-focus-border-color);
}

.biel-retry-button:disabled,
.biel-continue-button:disabled {
  opacity: 0.55;
  cursor: default;
}

@keyframes activity-turn {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .biel-retry-button,
  .biel-continue-button {
    transition: none;
  }
  .biel-activity-mark--busy,
  .biel-activity-label,
  .loading-animation .dot {
    animation: none;
  }
  .biel-chat-container {
    transition: none;
  }
}

@media (prefers-reduced-motion: reduce), (forced-colors: active) {
  .biel-activity-label--busy {
    animation: none;
    background: none;
    -webkit-text-fill-color: currentColor;
  }
}

@media (forced-colors: active) {
  .biel-activity-label--busy {
    -webkit-text-fill-color: CanvasText;
  }
}
