/**
 * PC Kompas FAQ - Modern Frontend Styles
 * Clean, minimal accordion design with subtle accents
 *
 * @package PC_Kompas_FAQ
 */

/* ============================================================================
   FAQ SECTION CONTAINER
   ============================================================================ */

.pkf-faq-section {
    position: relative;
    margin: clamp(2.5rem, 6vw, 4rem) 0 0 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border: none;
}

/* ============================================================================
   FAQ SECTION TITLE
   ============================================================================ */

.pkf-faq-title {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1vw, 0.75rem);
    font-size: clamp(1.25rem, 2vw + 0.5rem, 1.5rem);
    font-weight: 700;
    margin: 0 0 clamp(1.5rem, 3vw, 2.25rem) 0;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.3;
}

/* Question mark icon before FAQ title - distinguishes from SEO H2s */
.pkf-faq-title::before {
    content: '?';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(1.75rem, 3vw, 2rem);
    height: clamp(1.75rem, 3vw, 2rem);
    background: var(--accent);
    color: var(--bg-primary);
    font-size: clamp(1rem, 1.5vw, 1.125rem);
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ============================================================================
   FAQ ACCORDION CONTAINER
   ============================================================================ */

.pkf-faq-accordion {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ============================================================================
   FAQ ITEM (Individual Question Container with Divider)
   ============================================================================ */

.pkf-faq-item {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    transition: none;
    overflow: visible;
}

/* Last item - no bottom border */
.pkf-faq-item:last-child {
    border-bottom: none;
}

.pkf-faq-item:hover {
    border-color: var(--border);
    box-shadow: none;
}

/* First item - add top border for visual containment */
.pkf-faq-item:first-child {
    border-top: 1px solid var(--border);
}

/* ============================================================================
   FAQ QUESTION BUTTON - Modern Minimal Design
   ============================================================================ */

.pkf-faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: clamp(0.75rem, 1.5vw, 1rem);
    width: 100%;
    padding: clamp(1rem, 2vw, 1.25rem) 0;
    background: transparent;
    border: none;
    text-align: left;
    font-size: clamp(0.9375rem, 0.5vw + 0.85rem, 1.0625rem);
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1.5;
}

.pkf-faq-question:hover {
    color: var(--accent);
}

.pkf-faq-question:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Touch target for mobile accessibility (minimum 44px) */
.pkf-faq-question {
    min-height: max(44px, auto);
}

/* ============================================================================
   FAQ QUESTION TEXT
   ============================================================================ */

.pkf-faq-question-text {
    flex: 1;
    word-break: break-word;
    hyphens: auto;
}

/* ============================================================================
   FAQ CHEVRON ICON - Clean Minimal Animation
   ============================================================================ */

.pkf-faq-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(1.5rem, 3vw, 1.75rem);
    height: clamp(1.5rem, 3vw, 1.75rem);
    flex-shrink: 0;
    background: transparent;
    border-radius: 0;
    color: var(--text-secondary);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pkf-faq-icon svg {
    width: 60%;
    height: 60%;
    display: block;
}

/* Chevron rotation when open - smooth animation */
.pkf-faq-icon--open {
    transform: rotate(180deg);
    color: var(--accent);
}

/* ============================================================================
   FAQ ANSWER PANEL - Modern Reveal
   ============================================================================ */

.pkf-faq-answer {
    background: transparent;
    border-top: none;
}

/* Alpine collapse plugin - smooth expand/collapse animation */
[x-collapse] {
    overflow: hidden;
}

.pkf-faq-answer-content {
    padding: 0 0 clamp(1rem, 2vw, 1.25rem) 0;
    color: var(--text-secondary);
    font-size: clamp(0.9375rem, 0.5vw + 0.85rem, 1rem);
    line-height: 1.7;
}

/* Typography within answer content */
.pkf-faq-answer-content p {
    margin: 0 0 0.875rem 0;
}

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

.pkf-faq-answer-content ul,
.pkf-faq-answer-content ol {
    margin: 0.875rem 0;
    padding-left: 1.25rem;
}

.pkf-faq-answer-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.pkf-faq-answer-content li:last-child {
    margin-bottom: 0;
}

.pkf-faq-answer-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.pkf-faq-answer-content em {
    font-style: italic;
}

.pkf-faq-answer-content a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid transparent;
}

.pkf-faq-answer-content a:hover {
    color: var(--accent-hover);
    border-bottom-color: var(--accent-hover);
}

.pkf-faq-answer-content a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ============================================================================
   ADMIN EDIT LINK (Fixed Position for Admin Users)
   ============================================================================ */

.pkf-admin-edit-link {
    position: fixed;
    bottom: clamp(1rem, 2vw, 1.5rem);
    right: clamp(1rem, 2vw, 1.5rem);
    z-index: 100;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max(44px, 3rem);
    height: max(44px, 3rem);
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    font-size: 1rem;
}

.pkf-admin-edit-link:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

.pkf-admin-edit-link:focus-visible {
    outline: 2px solid var(--accent-hover);
    outline-offset: 2px;
}

/* Icon styling */
.pkf-admin-edit-link svg {
    width: 1.25rem;
    height: 1.25rem;
    display: block;
}

/* On small screens, show icon-only */
@media (max-width: 640px) {
    .pkf-admin-edit-link {
        width: max(44px, 2.75rem);
        height: max(44px, 2.75rem);
    }

    .pkf-admin-edit-link span {
        display: none;
    }
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 640px) {
    .pkf-faq-section {
        padding: 0;
    }

    .pkf-faq-title {
        font-size: clamp(1.125rem, 1.8vw + 0.5rem, 1.25rem);
    }
}

/* ============================================================================
   REDUCED MOTION - Accessibility First
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    .pkf-faq-question,
    .pkf-faq-icon,
    .pkf-admin-edit-link,
    .pkf-faq-answer-content a {
        transition: none;
    }

    .pkf-faq-icon--open {
        transform: none;
    }

    .pkf-admin-edit-link:hover {
        transform: none;
    }
}

/* ============================================================================
   FAQ INDEX PAGE
   Grid overview of all FAQ categories with cards linking to each section
   ============================================================================ */

.pkf-faq-index {
    padding: 0;
    max-width: 100%;
}

/* ============================================================================
   FAQ INDEX HEADER
   ============================================================================ */

.pkf-faq-index__header {
    margin-bottom: clamp(2rem, 4vw, 3rem);
    text-align: center;
}

.pkf-faq-index__title {
    font-size: clamp(1.75rem, 3vw + 0.5rem, 2.5rem);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 clamp(0.5rem, 1vw, 0.75rem) 0;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.pkf-faq-index__subtitle {
    font-size: clamp(1rem, 1.5vw + 0.25rem, 1.125rem);
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================================================
   FAQ INDEX SECTIONS
   ============================================================================ */

.pkf-faq-index__section {
    margin-bottom: clamp(2rem, 4vw, 3rem);
}

.pkf-faq-index__section:last-child {
    margin-bottom: 0;
}

.pkf-faq-index__section-title {
    font-size: clamp(1.125rem, 1.5vw + 0.25rem, 1.375rem);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 clamp(1rem, 2vw, 1.5rem) 0;
    padding-bottom: clamp(0.5rem, 1vw, 0.75rem);
    border-bottom: 1px solid var(--border);
}

/* ============================================================================
   FAQ INDEX GRID
   Responsive: 3 columns desktop, 2 tablet, 1 mobile
   ============================================================================ */

.pkf-faq-index__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(0.75rem, 1.5vw, 1rem);
}

@media (max-width: 900px) {
    .pkf-faq-index__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 540px) {
    .pkf-faq-index__grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   FAQ INDEX CARD
   Individual category card with icon, title, count, and arrow
   ============================================================================ */

.pkf-faq-index__card {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 1.5vw, 1rem);
    padding: clamp(1rem, 2vw, 1.25rem);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pkf-faq-index__card:hover {
    border-color: var(--accent);
    background: var(--bg-hover, var(--bg-tertiary));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.pkf-faq-index__card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-md, 8px);
}

/* Card Icon Container */
.pkf-faq-index__card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(2.5rem, 4vw, 3rem);
    height: clamp(2.5rem, 4vw, 3rem);
    background: var(--accent-light, rgba(74, 159, 212, 0.1));
    border-radius: var(--radius-sm, 6px);
    flex-shrink: 0;
    color: var(--accent);
}

.pkf-faq-index__card-icon svg {
    width: clamp(1.25rem, 2vw, 1.5rem);
    height: clamp(1.25rem, 2vw, 1.5rem);
}

/* Card Content */
.pkf-faq-index__card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.pkf-faq-index__card-title {
    font-size: clamp(0.9375rem, 1.25vw + 0.25rem, 1rem);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pkf-faq-index__card-description {
    font-size: clamp(0.8125rem, 1vw + 0.25rem, 0.875rem);
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Badge - Count pill */
.pkf-faq-index__card-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: clamp(1.5rem, 2vw, 1.75rem);
    height: clamp(1.5rem, 2vw, 1.75rem);
    padding: 0 clamp(0.375rem, 0.75vw, 0.5rem);
    background: var(--accent);
    color: #fff;
    font-size: clamp(0.75rem, 1vw + 0.125rem, 0.8125rem);
    font-weight: 600;
    border-radius: 9999px;
    flex-shrink: 0;
    line-height: 1;
}

/* Card Arrow */
.pkf-faq-index__card-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pkf-faq-index__card:hover .pkf-faq-index__card-arrow {
    opacity: 1;
    transform: translateX(0);
    color: var(--accent);
}

.pkf-faq-index__card-arrow svg {
    width: clamp(1rem, 1.5vw, 1.25rem);
    height: clamp(1rem, 1.5vw, 1.25rem);
}

/* ============================================================================
   FAQ INDEX HELP SECTION
   Subtle help text with link to forum
   ============================================================================ */

.pkf-faq-index__help {
    margin-top: clamp(2rem, 4vw, 3rem);
    padding: clamp(1rem, 2vw, 1.5rem);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    text-align: center;
}

.pkf-faq-index__help p {
    margin: 0;
    font-size: clamp(0.9375rem, 1vw + 0.25rem, 1rem);
    color: var(--text-secondary);
    line-height: 1.5;
}

.pkf-faq-index__help a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.pkf-faq-index__help a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.pkf-faq-index__help a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ============================================================================
   FAQ INDEX - DARK THEME ADJUSTMENTS
   ============================================================================ */

html.dark .pkf-faq-index__card {
    box-shadow: none;
}

html.dark .pkf-faq-index__card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* ============================================================================
   FAQ INDEX - REDUCED MOTION
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    .pkf-faq-index__card,
    .pkf-faq-index__card-arrow,
    .pkf-faq-index__help a {
        transition: none;
    }

    .pkf-faq-index__card-arrow {
        opacity: 1;
        transform: none;
    }
}
