/**
 * FAQ Bubble Item — one chat-transcript-style question/answer pair.
 *
 * Colors cascade down from custom properties set on the FAQ Bubble
 * container (see faq-bubble.twig), not authored per item.
 */

.faq-bubble-item {
  display: flex;
  flex-direction: column;
  margin-block-end: 1.25rem;
}

.faq-bubble-item__avatar {
  display: flex;
  flex: none;
  align-items: center;
  align-self: end;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.faq-bubble-item__avatar--question {
  color: var(--faq-bubble-item-q-color, #0d6efd);
}

/* --- Question row: bubble right-aligned, avatar after it -------------- */

.faq-bubble-item__question-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
  min-height: 4rem;
}

.faq-bubble-item__question {
  position: relative;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  align-self: self-start;
  max-width: 90%;
  padding: 0.65rem 1.25rem;
  cursor: pointer;
  transform-origin: right center;
  text-align: start;
  color: inherit;
  border: 0.3rem solid var(--faq-bubble-item-q-color, #0d6efd);
  border-radius: 1.25rem 1.25rem 0.25rem;
  background-color: #eef4ff;
}

[data-faq-bubble][data-fbi-q-color] .faq-bubble-item__question {
  background-color: color-mix(in sRGB, var(--faq-bubble-item-q-color) 10%, transparent);
}

.faq-bubble-item__question-text {
  flex: 1;
}

.faq-bubble-item__chevron {
  flex: none;
  transition: transform 0.3s ease;
}

.faq-bubble-item__question[aria-expanded="true"] .faq-bubble-item__chevron {
  transform: rotate(180deg);
}

/* --- Answer row: avatar before it, "clean container" + bubble --------- */

.faq-bubble-item__answer-row {
  display: flex;
  align-items: flex-start;
}

.faq-bubble-item__avatar--answer {
  align-self: start;
  transition: opacity 0.3s ease;
  opacity: 0;
  color: var(--faq-bubble-item-a-color, #6c757d);
}

.faq-bubble-item__avatar--answer.is-open {
  opacity: 1;
}

.faq-bubble-item__answer-shell {
  visibility: hidden;
  overflow: hidden;
  flex: 1;
  height: 0;
  opacity: 0;
}

.faq-bubble-item__answer-shell.is-open {
  visibility: visible;
  height: auto;
  opacity: 1;
}

.faq-bubble-item__answer {
  width: var(--faq-bubble-item-answer-width, 92%);
  margin-top: 1rem;
  margin-left: 0.5rem;
  padding: 0.85rem 1.25rem;
  white-space: pre-line;
  opacity: 0;
  color: inherit;
  border: 0.3rem solid var(--faq-bubble-item-a-color, #6c757d);
  border-radius: 0.25rem 1.25rem 1.25rem;
  background-color: #f8f9fa;
}

@media (prefers-reduced-motion: no-preference) {
  .faq-bubble-item__answer {
    transition: opacity 1.4s ease;
  }
}

[data-faq-bubble][data-fbi-a-color] .faq-bubble-item__answer {
  background-color: color-mix(in sRGB, var(--faq-bubble-item-a-color) 10%, transparent);
}

[data-faq-bubble][data-fbi-hide-avatars] .faq-bubble-item__avatar {
  display: none;
}

@media (min-width: 768px) {
  .faq-bubble-item__question {
    max-width: 70%;
  }

  .faq-bubble-item__answer {
    width: var(--faq-bubble-item-answer-width, 70%);
  }
}
