/* ===================================
   FAQ SECTION
   =================================== */

.faq {
  background: linear-gradient(135deg, rgba(52, 124, 191, 0.25) 0%, rgba(252, 175, 42, 0.25) 100%);
  position: relative;
  overflow: hidden;
}

.faq__container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* FAQ Page Header Styles */
.faq-page__header {
  text-align: center;
  margin-bottom: var(--space-16);
}

.faq-page__title {
  font-size: var(--text-6xl);
  font-weight: 800;
  color: var(--color-black);
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

[data-theme="dark"] .faq-page__title {
  color: var(--color-white-text);
}

.faq-page__description {
  font-size: var(--text-xl);
  color: var(--color-black);
  line-height: 1.6;
  max-width: 800px;
  margin: 0 auto;
}

[data-theme="dark"] .faq-page__description {
  color: var(--color-white-text);
}

.faq__list {
  display: flex;
  gap: var(--space-6);
  position: relative;
  align-items: flex-start;
}

/* FAQ Column */
.faq__column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* FAQ Item Base Styles */
.faq__item {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(52, 124, 191, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: box-shadow var(--transition-normal), background var(--transition-normal);
  overflow: hidden;
  position: relative;
  width: 100%;
}

/* Open state */
.faq__item--open {
  box-shadow: 0 4px 16px rgba(252, 175, 42, 0.15);
  background: rgba(255, 255, 255, 0.9);
}

/* Prevent clicks during animation */
.faq__item.faq-animating {
  pointer-events: none;
}

.faq__question {
  padding: var(--space-5) var(--space-6);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-black);
  line-height: 1.5;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  transition: all var(--transition-fast);
  user-select: none;
}

.faq__question::after {
  content: '+';
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
  color: var(--color-gray-600);
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

.faq__item--open .faq__question::after {
  content: '−';
  color: var(--color-orange);
}

/* ===================================
   ACCORDION ANIMATION TECHNIQUE
   =================================== */
/* 
 * Max-Height Strategy: Used for smooth expand/collapse animation
 * Rationale: max-height animates smoothly unlike height: auto
 * Initial state: max-height: 0 with overflow: hidden creates collapsed state
 * Opacity: Fades in/out for polished visual transition
 * 
 * Cubic-Bezier Timing: (0.4, 0, 0.2, 1) - Material Design easing curve
 * - Creates natural acceleration/deceleration
 * - Feels responsive without being jarring
 * 
 * Transition Duration: 0.4s for max-height provides smooth expansion
 * Opacity Duration: 0.3s slightly faster for snappy feel
 * Padding Transition: 0.3s ensures content spacing animates smoothly
 */
/* ===================================
   MAX-HEIGHT ANIMATION STRATEGY
   =================================== */
/* 
 * Why Max-Height Instead of Height:
 * - Height: auto cannot be animated smoothly
 * - Max-height: Can transition from 0 to a large value (e.g., 1000px)
 * - JavaScript sets actual max-height value dynamically
 * 
 * Overflow: Hidden ensures content doesn't leak during animation
 * Opacity: Starts at 0 for fade-in effect
 * Padding: Zero initially, expands when opened
 * 
 * Note: Actual max-height value is set via JavaScript based on content height
 */
/* FAQ Answer Styles */
.faq__answer {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.3s ease,
              padding 0.3s ease;
  background: transparent;
}

/* ===================================
   SMOOTH TRANSITION TIMING
   =================================== */
/* 
 * Expanded State Timing:
 * Max-height: 0.4s with cubic-bezier for natural motion
 * Opacity: 0.4s (slightly longer than collapsed) for smooth fade-in
 * Padding: 0.3s ensures content spacing appears smoothly
 * 
 * Timing Rationale:
 * - Slightly longer opacity on expand feels more polished
 * - Coordinated timing prevents animation conflicts
 * - Cubic-bezier provides professional easing curve
 */
.faq__item--open .faq__answer {
  opacity: 1;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.4s ease,
              padding 0.3s ease;
}

.faq__answer-content {
  padding: 0 var(--space-6);
  color: var(--color-gray-600);
  line-height: 1.6;
  font-size: var(--text-base);
}

.faq__item--open .faq__answer-content {
  padding: var(--space-6) var(--space-6) var(--space-8);
}

/* JavaScript handles the animation - CSS just provides the transition */

.faq__answer-text {
  margin: 0;
  padding: 0;
}

/* FAQ Dark Mode */
[data-theme="dark"] .faq {
  background: linear-gradient(135deg, rgba(52, 124, 191, 0.25) 0%, rgba(252, 175, 42, 0.25) 100%);
}

[data-theme="dark"] .faq__item {
  background: rgba(28, 47, 64, 0.96);
  border-color: rgba(96, 165, 250, 0.18);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .faq__item--open {
  background: rgba(28, 47, 64, 0.96);
}

[data-theme="dark"] .faq__question {
  background: transparent;
  color: var(--color-white-text);
}

[data-theme="dark"] .faq__answer {
  color: var(--color-gray-700);
}


/* FAQ Responsive */
/* FAQ Tablet (768px to 1023px) */
@media (max-width: 1023px) {
  .faq__container {
    max-width: 900px;
  }
}

/* FAQ Mobile (up to 767px) */
@media (max-width: 767px) {
  .faq__container {
    padding: 0 var(--space-4);
  }
  
  .faq__list {
    flex-direction: column;
  }
  
  .faq__column {
    width: 100%;
  }
  
  .faq-page__title {
    font-size: var(--text-4xl);
  }
  
  .faq-page__description {
    font-size: var(--text-lg);
  }
  
  .faq__question {
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-base);
  }
  
  .faq__answer-content {
    padding: 0 var(--space-5);
    font-size: var(--text-base);
  }
  
  .faq__item--open .faq__answer-content {
    padding: var(--space-5) var(--space-5) var(--space-6);
  }
}

/* FAQ Enhanced Interactions - Visible focus ring for keyboard users */
.faq__question:focus {
  outline: none;
}

.faq__question:focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: -2px;
  border-radius: var(--radius-lg);
}

/* FAQ Loading States */
.faq__item.loading .faq__question::after {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
