/**
 * HiGuppy FAQ Accordion Styles
 *
 * Styles for the FAQ page accordion, search, and category sections.
 * Uses CSS custom properties from higuppy-design-tokens.css.
 *
 * @package HiGuppy
 * @since 1.0.0
 */

/* ==========================================================================
   FAQ Page Container
   ========================================================================== */

.higuppy-faq-page {
  max-width: 840px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.faq-intro {
  margin-bottom: 2rem;
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--higuppy-neutral-900, #061b3d);
}

/* ==========================================================================
   Search Input
   ========================================================================== */

.faq-search-wrapper {
  position: relative;
  margin-bottom: 2.5rem;
}

.faq-search-input {
  width: 100%;
  padding: 14px 48px 14px 18px;
  font-size: 1rem;
  line-height: 1.5;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: var(--higuppy-neutral-900, #061b3d);
  transition: border-color 200ms ease, box-shadow 200ms ease;
  outline: none;
}

.faq-search-input:focus {
  border-color: var(--higuppy-secondary, #2e86c1);
  box-shadow: 0 0 0 3px rgba(46, 134, 193, 0.15);
}

.faq-search-input::placeholder {
  color: #9ca3af;
}

.faq-search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  pointer-events: none;
  opacity: 0.5;
}

.faq-no-results {
  margin-top: 1rem;
  padding: 1rem;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  color: #92400e;
  font-size: 0.95rem;
}

.faq-no-results a {
  color: #92400e;
  font-weight: 600;
  text-decoration: underline;
}

/* ==========================================================================
   Category Sections
   ========================================================================== */

.faq-category {
  margin-bottom: 2.5rem;
}

.faq-category h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--higuppy-primary, #1a5276);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--higuppy-secondary, #2e86c1);
}

/* ==========================================================================
   Accordion Items
   ========================================================================== */

.faq-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  background: #fff;
  overflow: hidden;
  transition: box-shadow 200ms ease, border-color 200ms ease;
}

.faq-item:hover {
  border-color: var(--higuppy-secondary, #2e86c1);
  box-shadow: 0 2px 8px rgba(26, 82, 118, 0.08);
}

.faq-item[open] {
  border-color: var(--higuppy-secondary, #2e86c1);
  box-shadow: 0 2px 12px rgba(26, 82, 118, 0.1);
}

/* Question / Summary */
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--higuppy-neutral-900, #061b3d);
  cursor: pointer;
  list-style: none;
  user-select: none;
  min-height: 44px;
  transition: background-color 150ms ease;
}

.faq-question:hover {
  background-color: var(--higuppy-neutral-100, #f7fbff);
}

/* Remove default marker */
.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::marker {
  display: none;
  content: '';
}

/* Custom expand/collapse indicator */
.faq-question::after {
  content: '+';
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin-left: 1rem;
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--higuppy-secondary, #2e86c1);
  border-radius: 50%;
  background: var(--higuppy-neutral-100, #f7fbff);
  transition: transform 300ms ease, background-color 200ms ease;
}

.faq-item[open] .faq-question::after {
  content: '−';
  transform: rotate(180deg);
  background: var(--higuppy-secondary, #2e86c1);
  color: #fff;
}

/* Answer content */
.faq-answer {
  padding: 0 1.25rem 1.25rem;
  font-size: 1rem;
  line-height: 1.7;
  color: #374151;
  opacity: 1;
}

.faq-answer p {
  margin: 0 0 0.75rem;
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

.faq-answer a {
  color: var(--higuppy-secondary, #2e86c1);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.faq-answer a:hover {
  color: var(--higuppy-primary, #1a5276);
}

/* ==========================================================================
   Animation States
   ========================================================================== */

.faq-item--animating .faq-answer {
  overflow: hidden;
}

/* When JS hasn't loaded, native <details> behavior works fine.
   These styles ensure smooth visual for the non-JS state. */
.faq-item:not([open]) .faq-answer {
  padding-top: 0;
  padding-bottom: 0;
}

/* ==========================================================================
   Search Highlight State
   ========================================================================== */

.faq-item--highlight {
  border-color: var(--higuppy-accent, #ff6a2a);
  box-shadow: 0 0 0 2px rgba(255, 106, 42, 0.15);
}

/* ==========================================================================
   Reference Links Section
   ========================================================================== */

.faq-reference-links {
  margin-top: 3rem;
  padding: 2rem;
  background: var(--higuppy-neutral-100, #f7fbff);
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.faq-reference-links h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--higuppy-primary, #1a5276);
  margin-bottom: 0.75rem;
}

.faq-reference-links p {
  margin-bottom: 1rem;
  color: #374151;
}

.faq-reference-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.faq-reference-links li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.faq-reference-links li:last-child {
  border-bottom: none;
}

.faq-reference-links a {
  color: var(--higuppy-secondary, #2e86c1);
  font-weight: 600;
  text-decoration: none;
}

.faq-reference-links a:hover {
  color: var(--higuppy-primary, #1a5276);
  text-decoration: underline;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
  .higuppy-faq-page {
    padding: 1.5rem 0.75rem;
  }

  .faq-category h2 {
    font-size: 1.3rem;
  }

  .faq-question {
    font-size: 0.95rem;
    padding: 0.875rem 1rem;
  }

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

  .faq-reference-links {
    padding: 1.5rem 1rem;
  }
}

@media (max-width: 480px) {
  .faq-search-input {
    padding: 12px 40px 12px 14px;
    font-size: 0.95rem;
  }

  .faq-question::after {
    width: 24px;
    height: 24px;
    font-size: 1.1rem;
  }
}
