/* ==========================================================================
   PORTAL WEB DE ENFERMERÍA - MARILUZ MERCADO TAPIA
   SECCIÓN DE PREGUNTAS FRECUENTES (FAQ) - REDISEÑO PREMIUM & ANIMACIONES
   ========================================================================== */

:root {
  --primary: #0F2B48;          /* Azul marino profundo */
  --terracotta: #D48C70;        /* Terracota cálido */
  --gold: #D4AF37;              /* Dorado premium */
  --cream: #FDFBF7;             /* Crema claro */
  --cream-dark: #F5EFE6;        /* Crema oscuro */
  --sage: #8EA89D;              /* Verde suave */
  --ink: #1A1A1A;               /* Texto principal */
  --ink-muted: #5A5A5A;         /* Texto secundario */
  --border-subtle: rgba(15, 43, 72, 0.08);
  --shadow-sm: 0 2px 6px rgba(15, 43, 72, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 43, 72, 0.08);
  --shadow-lg: 0 16px 36px rgba(15, 43, 72, 0.12);
  --shadow-glow: 0 0 24px rgba(212, 140, 112, 0.18);
}

/* ==========================================================================
   ESTRUCTURA DE SECCIÓN Y ELEMENTOS DECORATIVOS DE FONDO
   ========================================================================== */

.faq-section {
  position: relative;
  overflow: hidden;
  padding: 5.5rem 1.5rem;
  background: linear-gradient(135deg, #FDFBF7 0%, #F5EFE6 100%);
}

/* Orbes decorativos difuminados */
.faq-section::before {
  content: '';
  position: absolute;
  top: -120px;
  right: -120px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(212, 140, 112, 0.18) 0%, transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}

.faq-section::after {
  content: '';
  position: absolute;
  bottom: -120px;
  left: -120px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.14) 0%, transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}

.faq-container {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   ENCABEZADO: TÍTULO Y SUBTÍTULO
   ========================================================================== */

.faq-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin: 0 auto 0.75rem auto;
  position: relative;
  display: block;
  line-height: 1.25;
}

.faq-title::after {
  content: '';
  display: block;
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--terracotta), var(--gold));
  margin: 1.1rem auto 0 auto;
  border-radius: 2px;
}

.faq-subtitle {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1.05rem;
  color: var(--ink-muted);
  text-align: center;
  margin: 0 auto 3rem auto;
  max-width: 650px;
  line-height: 1.65;
}

/* ==========================================================================
   LISTA Y TARJETAS DEL ACORDEÓN (ANIMACIONES DE SCROLL & INTERACCIÓN)
   ========================================================================== */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-item {
  position: relative;
  background-color: #FFFFFF;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s ease,
              border-color 0.35s ease;
}

/* Animación 1: Fade-in al hacer scroll */
.faq-item.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Animación 4: Hover en la tarjeta */
.faq-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(212, 140, 112, 0.28);
}

/* Animación 5: Borde izquierdo animado con gradiente */
.faq-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: linear-gradient(180deg, var(--terracotta), var(--gold));
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
  border-radius: 16px 0 0 16px;
}

.faq-item.active {
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: rgba(212, 140, 112, 0.35);
}

.faq-item.active::before {
  width: 4px;
}

/* ==========================================================================
   BOTÓN PREGUNTA (DISPARADOR DEL ACORDEÓN)
   ========================================================================== */

.faq-question {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 1.35rem 1.75rem;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  gap: 1.25rem;
  position: relative;
  z-index: 1;
  transition: background-color 0.3s ease;
}

.faq-question:hover {
  background-color: rgba(212, 140, 112, 0.04);
}

.faq-question:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: -2px;
}

/* Animación 6: Número decorativo */
.faq-number {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.85rem;
  font-weight: 700;
  color: rgba(212, 140, 112, 0.22);
  line-height: 1;
  letter-spacing: -0.02em;
  transition: color 0.4s ease, transform 0.3s ease;
  flex-shrink: 0;
  user-select: none;
}

.faq-item.active .faq-number {
  color: rgba(212, 140, 112, 0.65);
  transform: scale(1.05);
}

.faq-question-text {
  flex: 1;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.45;
  transition: color 0.3s ease;
}

.faq-question:hover .faq-question-text {
  color: var(--terracotta);
}

.faq-item.active .faq-question-text {
  color: var(--primary);
  font-weight: 700;
}

/* Animación 2: Transición del ícono chevron */
.faq-icon {
  flex-shrink: 0;
  color: var(--terracotta);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
  margin-left: auto;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
  color: var(--terracotta);
}

/* ==========================================================================
   Animación 3: Apertura / Cierre de la respuesta
   ========================================================================== */

.faq-answer {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0 1.75rem;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s ease,
              padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.975rem;
  line-height: 1.75;
  color: var(--ink);
  box-sizing: border-box;
}

.faq-item.active .faq-answer {
  max-height: 500px;
  opacity: 1;
  padding: 0 1.75rem 1.5rem 1.75rem;
}

.faq-answer p {
  margin: 0;
  color: #3A4550;
  border-top: 1px dashed rgba(15, 43, 72, 0.08);
  padding-top: 1rem;
}

/* ==========================================================================
   ADAPTACIÓN RESPONSIVE (MOBILE-FIRST & ACCESIBILIDAD)
   ========================================================================== */

@media (max-width: 768px) {
  .faq-section {
    padding: 3.5rem 1rem;
  }

  .faq-section::before {
    top: -70px;
    right: -70px;
    width: 240px;
    height: 240px;
  }

  .faq-section::after {
    bottom: -70px;
    left: -70px;
    width: 240px;
    height: 240px;
  }

  .faq-title {
    font-size: 1.85rem;
  }

  .faq-title::after {
    width: 60px;
    height: 2.5px;
    margin: 0.85rem auto 0 auto;
  }

  .faq-subtitle {
    font-size: 0.95rem;
    margin-bottom: 2rem;
  }

  .faq-question {
    padding: 1.1rem 1.25rem;
    min-height: 48px;
    gap: 0.85rem;
  }

  .faq-number {
    font-size: 1.4rem;
  }

  .faq-question-text {
    font-size: 0.95rem;
  }

  .faq-answer {
    padding: 0 1.25rem;
    font-size: 0.925rem;
    line-height: 1.65;
  }

  .faq-item.active .faq-answer {
    padding: 0 1.25rem 1.25rem 1.25rem;
  }

  .faq-answer p {
    padding-top: 0.85rem;
  }
}

@media (max-width: 480px) {
  .faq-section {
    padding: 3rem 0.85rem;
  }

  .faq-title {
    font-size: 1.65rem;
  }

  .faq-question {
    padding: 1rem;
    gap: 0.65rem;
  }

  .faq-number {
    font-size: 1.25rem;
  }

  .faq-question-text {
    font-size: 0.9rem;
  }

  .faq-answer {
    padding: 0 1rem;
    font-size: 0.885rem;
  }

  .faq-item.active .faq-answer {
    padding: 0 1rem 1.15rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .faq-item,
  .faq-item::before,
  .faq-icon,
  .faq-answer,
  .faq-number,
  .faq-question,
  .faq-question-text {
    transition: none !important;
    animation: none !important;
  }

  .faq-item {
    opacity: 1 !important;
    transform: none !important;
  }
}