/**
 * Savour The Pho - FAQ & Rank Math FAQ Styling
 * Modern, clean, accessible Accordion & Boxed FAQ
 *
 * @package GP_FoodBlog
 * @version 1.4.5
 */

:root {
    --stp-faq-border: #e5e7eb;
    --stp-faq-border-hover: #cbd5e1;
    --stp-faq-border-open: #fcd3c1;
    --stp-faq-bg: #ffffff;
    --stp-faq-bg-hover: #fafafa;
    --stp-faq-title: #111827;
    --stp-faq-text: #374151;
    --stp-faq-accent: #e05a47;
    --stp-faq-accent-soft: rgba(224, 90, 71, 0.08);
    --stp-faq-radius: 12px;
}

/* ==========================================================================
   1. FAQ CONTAINER (RANK MATH BLOCK & NATIVE ACCORDION)
   ========================================================================== */
#rank-math-faq,
.wp-block-rank-math-faq-block,
.stp-faq-section {
    margin: 2.5rem 0 2rem;
    clear: both;
    font-family: inherit;
}

/* List resets */
#rank-math-faq .rank-math-list,
.wp-block-rank-math-faq-block .rank-math-list,
.stp-faq-accordion {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ==========================================================================
   2. FAQ ITEM (CARD BOX)
   ========================================================================== */
#rank-math-faq .rank-math-list-item,
.wp-block-rank-math-faq-block .rank-math-faq-item,
details.stp-faq-item {
    background: var(--stp-faq-bg);
    border: 1px solid var(--stp-faq-border);
    border-radius: var(--stp-faq-radius);
    margin: 0 0 12px 0 !important;
    padding: 0 !important;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    box-sizing: border-box;
}

#rank-math-faq .rank-math-list-item:hover,
.wp-block-rank-math-faq-block .rank-math-faq-item:hover,
details.stp-faq-item:hover {
    border-color: var(--stp-faq-border-hover);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

#rank-math-faq .rank-math-list-item.is-open,
details.stp-faq-item[open] {
    border-color: var(--stp-faq-border-open);
    box-shadow: 0 4px 16px rgba(224, 90, 71, 0.06);
}

/* ==========================================================================
   3. QUESTION HEADER
   ========================================================================== */
#rank-math-faq .rank-math-question,
.wp-block-rank-math-faq-block .rank-math-question,
summary.stp-faq-question {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 !important;
    padding: 16px 20px !important;
    font-size: 1.08rem !important;
    line-height: 1.45 !important;
    font-weight: 600 !important;
    color: var(--stp-faq-title) !important;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}

summary.stp-faq-question::-webkit-details-marker,
summary.stp-faq-question::marker {
    display: none !important;
}

#rank-math-faq .rank-math-question:hover,
summary.stp-faq-question:hover {
    color: var(--stp-faq-accent) !important;
    background-color: var(--stp-faq-bg-hover);
}

/* Left Question Badge & Text wrapper */
.stp-faq-q-text,
#rank-math-faq .rank-math-question > strong,
#rank-math-faq .rank-math-question {
    font-weight: 600;
}

/* Animated Chevron Icon */
.stp-faq-chevron {
    width: 20px;
    height: 20px;
    min-width: 20px;
    color: #64748b;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#rank-math-faq .rank-math-question:hover .stp-faq-chevron,
summary.stp-faq-question:hover .stp-faq-chevron {
    color: var(--stp-faq-accent);
}

#rank-math-faq .rank-math-list-item.is-open .stp-faq-chevron,
details.stp-faq-item[open] .stp-faq-chevron {
    transform: rotate(180deg);
    color: var(--stp-faq-accent);
}

/* ==========================================================================
   4. ANSWER CONTENT
   ========================================================================== */
#rank-math-faq .rank-math-answer,
.wp-block-rank-math-faq-block .rank-math-answer,
.stp-faq-answer {
    padding: 0 20px 18px 20px;
    color: var(--stp-faq-text);
    font-size: 1rem;
    line-height: 1.75;
    margin: 0;
}

#rank-math-faq .rank-math-answer p,
.wp-block-rank-math-faq-block .rank-math-answer p,
.stp-faq-answer p {
    margin: 0 0 12px 0;
}

#rank-math-faq .rank-math-answer p:last-child,
.wp-block-rank-math-faq-block .rank-math-answer p:last-child,
.stp-faq-answer p:last-child {
    margin-bottom: 0;
}

#rank-math-faq .rank-math-answer ul,
#rank-math-faq .rank-math-answer ol,
.stp-faq-answer ul,
.stp-faq-answer ol {
    margin: 0 0 12px 0;
    padding-left: 1.35rem;
}

#rank-math-faq .rank-math-answer strong,
.stp-faq-answer strong {
    color: var(--stp-faq-title);
    font-weight: 600;
}

/* ==========================================================================
   5. PROGRESSIVE ACCORDION COLLAPSE FOR RANK MATH FAQ
   ========================================================================== */
/* Khi JavaScript kích hoạt Accordion trên Rank Math */
.stp-faq-interactive .rank-math-answer {
    display: none;
}

.stp-faq-interactive .rank-math-list-item.is-open .rank-math-answer {
    display: block;
    animation: stpFaqFadeIn 0.25s ease-out;
}

@keyframes stpFaqFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Native HTML5 Details animation */
details.stp-faq-item[open] .stp-faq-answer {
    animation: stpFaqFadeIn 0.25s ease-out;
}

/* ==========================================================================
   6. GUTENBERG EDITOR COMPATIBILITY
   ========================================================================== */
.editor-styles-wrapper #rank-math-faq .rank-math-list-item {
    border: 1px solid var(--stp-faq-border);
    border-radius: var(--stp-faq-radius);
    padding: 12px !important;
    margin-bottom: 12px !important;
}

.editor-styles-wrapper #rank-math-faq .rank-math-item-header {
    margin-bottom: 8px;
}
