/**
 * FAQ Section — Premium COD E-commerce Accordion
 *
 * Uses native HTML <details>/<summary> elements (no JS needed).
 * Shared by FAQ-Home (sections/fqn-home.php) and FAQ-Product (single-product.php).
 *
 * @package Codlion
 * @since 1.0.0
 */

/* ==========================================================================
   FAQ Section Container
   ========================================================================== */

.cl-faq-section {
    padding: 8px 0;
    margin: 0;
    background: var(--bg-color, #fafafa);
}

.cl-faq-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Section heading */
.cl-faq-section h2 {
    text-align: center;
    font-size: var(--h2-font-size);
    font-weight: var(--heading-font-weight);
    color: var(--text-color);
    margin: 0 0 40px 0;
    font-family: var(--heading-font);
    line-height: var(--heading-line-height, 1.2);
}

/* ==========================================================================
   FAQ Accordion Items (details/summary)
   ========================================================================== */

.cl-faq-section details {
    background: #fff;
    border: 1px solid var(--cl-border, #e5e7eb);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.cl-faq-section details:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border-color: var(--primary-color);
}

.cl-faq-section details[open] {
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Summary (question row) */
.cl-faq-section details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    list-style: none;
    user-select: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Remove default marker (Chrome shows triangle) */
.cl-faq-section details > summary::-webkit-details-marker {
    display: none;
}

.cl-faq-section details > summary:hover {
    color: var(--primary-color);
}

.cl-faq-section details[open] > summary {
    color: var(--primary-color);
    border-bottom: 1px solid var(--cl-border, #e5e7eb);
}

/* Chevron indicator using ::after — chevron-down when closed, chevron-up when open */
.cl-faq-section details > summary::after {
    content: '';
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    border-radius: 50%;
    -webkit-mask-image: url("../icons/chevron-down.svg");
    mask-image: url("../icons/chevron-down.svg");
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 14px 14px;
    mask-size: 14px 14px;
    transition: background 0.2s ease;
}

.cl-faq-section details[open] > summary::after {
    -webkit-mask-image: url("../icons/chevron-up.svg");
    mask-image: url("../icons/chevron-up.svg");
}

/* Answer content */
.cl-faq-section details > *:not(summary) {
    padding: 0 24px;
}

.cl-faq-section details p {
    margin: 0;
    padding: 16px 24px 20px 24px;
    font-size: 14px;
    line-height: var(--body-line-height);
    color: var(--light-text-color, #777);
    font-weight: var(--body-font-weight);
}

/* ==========================================================================
   FAQ-Product (inside product page)
   ========================================================================== */

.cl-faq-product-section {
    margin: 40px 0 0 0;
    padding: 0;
}

.cl-faq-product-section .cl-faq-container {
    max-width: 100%;
    padding: 0;
}

.cl-faq-product-section h2 {
    font-size: var(--h3-font-size);
    margin-bottom: 24px;
}

/* ==========================================================================
   RTL Support
   ========================================================================== */

body.rtl-mode .cl-faq-section details > summary {
    text-align: right;
}

body.rtl-mode .cl-faq-section details > summary::after {
    order: -1;
    margin-left: 0;
    margin-right: 0;
}

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

@media (max-width: 991px) {
    .cl-faq-section {
        padding: 6px 0;
        margin: 0;
    }

    .cl-faq-section h2 {
        font-size: var(--h3-font-size);
        margin-bottom: 28px;
    }

    .cl-faq-section details > summary {
        padding: 16px 18px;
        font-size: 14px;
    }

    .cl-faq-section details > summary::after {
        width: 24px;
        height: 24px;
        font-size: 18px;
    }

    .cl-faq-section details p {
        padding: 14px 18px 18px 18px;
        font-size: 13px;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .cl-faq-section details,
    .cl-faq-section details > summary,
    .cl-faq-section details > summary::after {
        transition: none;
    }
}
