/* ============================================
   FAQ WhatsApp-style — Chat Jurídico
   Mimics a WhatsApp conversation UI
   ============================================ */

/* ===== Section ===== */
.faq {
  padding: 4.5rem 0;
  position: relative;
  overflow: hidden;
  background: #f0f6fc;
}

.faq__container {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ===== Title ===== */
.faq__title {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 0.4rem;
}

.faq__subtitle {
  text-align: center;
  font-size: 1.05rem;
  color: #6b7280;
  margin-bottom: 2rem;
}

/* ===== List ===== */
.faq__list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ===== Item ===== */
.faq__item {
  border-radius: 12px;
}

/* ===== Question (button) ===== */
.faq__question {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
}

.faq__question:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
  border-radius: 12px;
}

/* ── Question avatar ── */
.faq__q-avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  align-self: flex-end;
}

/* ── Question bubble ── */
.faq__q-bubble {
  position: relative;
  background: #ffffff;
  border-radius: 0 12px 12px 12px;
  padding: 0.7rem 1rem;
  padding-right: 3.4rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s;
}

.faq__q-bubble::before {
  content: '';
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 8px 8px 0;
  border-color: transparent #ffffff transparent transparent;
}

.faq__question:hover .faq__q-bubble {
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.faq__q-text {
  font-size: 0.94rem;
  line-height: 1.5;
  color: #111b21;
  font-weight: 500;
}

.faq__q-time {
  position: absolute;
  bottom: 0.35rem;
  right: 0.55rem;
  font-size: 0.62rem;
  color: #8696a0;
  white-space: nowrap;
}

/* ── Toggle icon ── */
.faq__toggle-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(59,130,246,0.1);
  color: #3b82f6;
  transition: transform 0.3s, background 0.3s;
}

.faq__item--open .faq__toggle-icon {
  background: rgba(59,130,246,0.18);
}

.faq__toggle-v {
  transition: transform 0.3s, opacity 0.3s;
  transform-origin: center;
}

.faq__item--open .faq__toggle-v {
  opacity: 0;
  transform: scaleY(0);
}

/* ===== Answer ===== */
.faq__answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq__a-wrap {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0.35rem 0 1rem;
}

/* ── Answer bubble ── */
.faq__a-bubble {
  position: relative;
  background: #dbeafe;
  border-radius: 12px 0 12px 12px;
  padding: 0.7rem 1rem;
  padding-right: 3.4rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  max-width: 85%;
}

.faq__a-bubble::after {
  content: '';
  position: absolute;
  top: 0;
  right: -8px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 8px 8px;
  border-color: transparent transparent transparent #dbeafe;
}

.faq__a-text {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #111b21;
  text-align: left;
}

.faq__a-text p {
  margin: 0 0 0.65em 0;
}

.faq__a-text p:last-child {
  margin-bottom: 0;
}

.faq__a-time {
  position: absolute;
  bottom: 0.35rem;
  right: 0.55rem;
  font-size: 0.62rem;
  color: #8696a0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.faq__a-time::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='12' fill='none'%3E%3Cpath d='M1.5 6.5L5 10l7-8' stroke='%2353bdeb' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M5.5 6.5L9 10l5.5-8' stroke='%2353bdeb' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
}

/* ── Reaction emoji ── */
.faq__reaction {
  position: absolute;
  bottom: -12px;
  left: 10px;
  font-size: 16px;
  line-height: 1;
  background: #fff;
  border-radius: 20px;
  padding: 2px 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 2;
}

.faq__reaction--show {
  opacity: 1;
  transform: scale(1);
}

/* ── Answer avatar ── */
.faq__a-avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.faq__a-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .faq {
    padding: 3rem 0;
  }

  .faq__title {
    font-size: 1.5rem;
  }

  .faq__subtitle {
    font-size: 0.92rem;
    margin-bottom: 1.5rem;
  }

  .faq__q-avatar,
  .faq__a-avatar {
    width: 28px;
    height: 28px;
  }

  .faq__q-avatar svg {
    width: 15px;
    height: 15px;
  }

  .faq__q-text,
  .faq__a-text {
    font-size: 0.86rem;
  }

  .faq__toggle-icon {
    width: 26px;
    height: 26px;
  }

  .faq__toggle-icon svg {
    width: 15px;
    height: 15px;
  }

  .faq__a-bubble {
    max-width: 90%;
  }
}

@media (max-width: 480px) {
  .faq__q-bubble,
  .faq__a-bubble {
    padding: 0.5rem 0.7rem;
    padding-right: 2.8rem;
  }

  .faq__a-bubble {
    max-width: 94%;
  }
}

/* ===== Print ===== */
@media print {
  .faq__answer {
    max-height: none !important;
    overflow: visible;
  }

  .faq__toggle-icon {
    display: none;
  }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
  .faq__answer {
    transition: none;
  }

  .faq__toggle-v {
    transition: none;
  }
}
