/* ==================================================
   FAQ SECTION STYLES
   (استایل‌های اختصاصی بخش سوالات متداول و دسته‌بندی‌ها)
   ================================================== */

/* ---------- Section Wrapper ---------- */
.custom-education-theme-faq {
    padding: 60px 24px;
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

/* ---------- FAQ List ---------- */
.custom-education-theme-faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ---------- FAQ Item (آکاردئون) ---------- */
.custom-education-theme-faq-item {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    isolation: isolate;
}

    /* درخشش پشت در حالت باز */
    .custom-education-theme-faq-item::before {
        content: '';
        position: absolute;
        inset: -1px;
        border-radius: var(--radius-lg);
        background: var(--accent-gradient);
        opacity: 0;
        z-index: -1;
        filter: blur(20px);
        transition: opacity 0.4s ease;
    }

    .custom-education-theme-faq-item.custom-education-theme-open {
        border-color: var(--accent-glow-35);
        box-shadow: 0 14px 40px var(--accent-glow-12);
    }

        .custom-education-theme-faq-item.custom-education-theme-open::before {
            opacity: 0.25;
        }

    .custom-education-theme-faq-item:hover {
        border-color: var(--accent-glow-25);
    }

/* ---------- FAQ Question (هدر) ---------- */
.custom-education-theme-faq-question {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 18px 22px;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: right;
    transition: var(--transition);
    font-family: var(--font-family);
}

[dir="ltr"] .custom-education-theme-faq-question {
    text-align: left;
}

.custom-education-theme-faq-question:hover {
    background: var(--accent-glow-04);
}

/* آیکون سوال */
.custom-education-theme-faq-question-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    background: var(--accent-gradient);
    box-shadow: 0 6px 18px var(--accent-glow-30);
    flex-shrink: 0;
    transition: var(--transition);
}

.custom-education-theme-faq-item.custom-education-theme-open .custom-education-theme-faq-question-icon {
    transform: scale(1.08) rotate(-6deg);
    box-shadow: 0 8px 22px var(--accent-glow-45);
}

/* متن سوال */
.custom-education-theme-faq-question-text {
    flex: 1;
    min-width: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

.custom-education-theme-faq-item.custom-education-theme-open .custom-education-theme-faq-question-text {
    color: var(--accent);
}

/* ---------- دکمه‌ها و فلش (سمت چپ سوال) ---------- */
.custom-education-theme-faq-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* دکمه مشاهده اصلی */
.custom-education-theme-faq-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 4px 12px var(--accent-glow-25);
}

    .custom-education-theme-faq-action:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px var(--accent-glow-45);
        color: #fff;
    }

/* دکمه مشاهده کوچک (برای زیرشاخه‌ها) */
.custom-education-theme-faq-action-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
    background: var(--accent-glow-12);
    color: var(--accent);
    box-shadow: none;
}

    .custom-education-theme-faq-action-sm:hover {
        background: var(--accent-gradient);
        color: #fff;
    }

/* فلش چرخشی */
.custom-education-theme-faq-arrow {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 0.75rem;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), background 0.3s ease, color 0.3s ease;
    flex-shrink: 0;
}

.custom-education-theme-faq-item.custom-education-theme-open .custom-education-theme-faq-arrow {
    transform: rotate(180deg);
    background: var(--accent-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 16px var(--accent-glow-35);
}

/* ---------- FAQ Answer (محتوای باز شونده) ---------- */
.custom-education-theme-faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.custom-education-theme-faq-item.custom-education-theme-open .custom-education-theme-faq-answer {
    max-height: 1000px; /* افزایش یافته برای نمایش بهتر زیرشاخه‌ها */
}

.custom-education-theme-faq-answer-inner {
    padding: 0 22px 22px 76px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.9;
    text-align: justify;
    text-justify: inter-word;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px dashed var(--glass-border);
    padding-top: 16px;
    margin-top: -1px;
}

[dir="rtl"] .custom-education-theme-faq-answer-inner {
    padding: 16px 76px 22px 22px;
}

[dir="ltr"] .custom-education-theme-faq-answer-inner {
    padding: 16px 22px 22px 76px;
}

.custom-education-theme-faq-answer-inner p {
    margin: 0;
}

/* اگه جواب لینک داشته باشه */
.custom-education-theme-faq-answer-inner a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    transition: var(--transition);
}

    .custom-education-theme-faq-answer-inner a:hover {
        color: var(--accent-2);
    }

/* ---------- زیرشاخه‌ها (Children) ---------- */
.custom-education-theme-faq-children {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

/* استایل پایه آیتم (پیش‌فرض 100%) */
.custom-education-theme-faq-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    flex: 0 0 100%;
}

    .custom-education-theme-faq-child:hover {
        border-color: var(--accent-glow-35);
        background: var(--accent-glow-08);
        transform: translateY(-2px);
    }

.custom-education-theme-faq-child-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.88rem;
}

    .custom-education-theme-faq-child-title i {
        color: var(--accent);
    }

/* ==================================================
   منطق چیدمان هوشمند زیرشاخه‌ها (دسکتاپ)
   - فرد: آخری 100%
   - زوج: همه 50% یا 33%
   ================================================== */
@media (min-width: 641px) {

    /* === حالت‌های زوج === */

    /* دقیقا 2 آیتم: 50% */
    .custom-education-theme-faq-children:has(> :nth-child(2):last-child) > * {
        flex: 0 0 calc(50% - 5px);
    }

    /* دقیقا 4 آیتم: 50% */
    .custom-education-theme-faq-children:has(> :nth-child(4):last-child) > * {
        flex: 0 0 calc(50% - 5px);
    }

    /* دقیقا 6 آیتم: 33.33% */
    .custom-education-theme-faq-children:has(> :nth-child(6):last-child) > * {
        flex: 0 0 calc(33.333% - 7px);
    }

    /* === حالت‌های فرد === */

    /* دقیقا 3 آیتم: همه 33.33% */
    .custom-education-theme-faq-children:has(> :nth-child(3):last-child) > * {
        flex: 0 0 calc(33.333% - 7px);
    }

    /* دقیقا 5 آیتم: 4 تای اول 50%، آخری 100% */
    .custom-education-theme-faq-children:has(> :nth-child(5):last-child) > * {
        flex: 0 0 calc(50% - 5px);
    }

    .custom-education-theme-faq-children:has(> :nth-child(5):last-child) > :nth-child(5) {
        flex: 0 0 100%;
    }

    /* دقیقا 7 آیتم: 6 تای اول 33.33%، آخری 100% */
    .custom-education-theme-faq-children:has(> :nth-child(7):last-child) > * {
        flex: 0 0 calc(33.333% - 7px);
    }

    .custom-education-theme-faq-children:has(> :nth-child(7):last-child) > :nth-child(7) {
        flex: 0 0 100%;
    }

    /* === 8 آیتم و بیشتر === */
    /* پیش‌فرض 3 ستونه (33.33%) */
    .custom-education-theme-faq-children:has(> :nth-child(n+8)) > * {
        flex: 0 0 calc(33.333% - 7px);
    }

    /* اگر تعداد فرد بود، آخری 100% */
    .custom-education-theme-faq-children:has(> :nth-child(n+8)):has(> :nth-child(odd):last-child) > :last-child {
        flex: 0 0 100%;
    }
}

/* ---------- FAQ Categories (تب‌های دسته‌بندی) ---------- */
.custom-education-theme-faq-categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
}

.custom-education-theme-faq-category {
    padding: 9px 18px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

    .custom-education-theme-faq-category i {
        font-size: 0.78rem;
        color: var(--accent);
        transition: var(--transition);
    }

    .custom-education-theme-faq-category:hover {
        border-color: var(--accent-glow-35);
        color: var(--accent);
        transform: translateY(-2px);
    }

    .custom-education-theme-faq-category.custom-education-theme-active {
        background: var(--accent-gradient);
        color: #fff;
        border-color: transparent;
        box-shadow: 0 6px 18px var(--accent-glow-35);
    }

        .custom-education-theme-faq-category.custom-education-theme-active i {
            color: #fff;
        }

    .custom-education-theme-faq-category .custom-education-theme-category-count {
        background: rgba(255, 255, 255, 0.25);
        padding: 2px 8px;
        border-radius: 10px;
        font-size: 0.7rem;
        font-weight: 700;
        line-height: 1;
    }

/* ---------- FAQ CTA (پایین بخش) ---------- */
.custom-education-theme-faq-cta {
    margin-top: 40px;
    padding: 28px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

    .custom-education-theme-faq-cta::before {
        content: '';
        position: absolute;
        top: -60px;
        right: -60px;
        width: 180px;
        height: 180px;
        border-radius: 50%;
        background: var(--accent-gradient);
        opacity: 0.08;
        filter: blur(40px);
        pointer-events: none;
        z-index: -1;
    }

.custom-education-theme-faq-cta-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    background: var(--accent-gradient);
    box-shadow: 0 10px 25px var(--accent-glow-40), 0 0 40px var(--accent-glow-20);
    animation: customEducationThemeFaqCtaPulse 3s ease-in-out infinite;
}

@keyframes customEducationThemeFaqCtaPulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.06);
    }
}

.custom-education-theme-faq-cta h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.custom-education-theme-faq-cta p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.8;
    max-width: 480px;
}

.custom-education-theme-faq-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 26px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: var(--accent-gradient);
    color: #fff;
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 8px 22px var(--accent-glow-35);
    margin-top: 6px;
}

    .custom-education-theme-faq-cta-btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 12px 30px var(--accent-glow-50);
    }

    .custom-education-theme-faq-cta-btn i {
        font-size: 0.85rem;
    }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .custom-education-theme-faq {
        padding: 40px 16px;
    }

    .custom-education-theme-faq-question {
        padding: 16px 18px;
        gap: 10px;
    }

    .custom-education-theme-faq-question-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .custom-education-theme-faq-question-text {
        font-size: 0.9rem;
    }

    /* کوچک کردن دکمه مشاهده در موبایل */
    .custom-education-theme-faq-action {
        padding: 6px 10px;
        font-size: 0.7rem;
    }

        .custom-education-theme-faq-action i {
            display: none; /* حذف آیکون در موبایل برای صرفه‌جویی در فضا */
        }

    .custom-education-theme-faq-arrow {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }

    .custom-education-theme-faq-answer-inner,
    [dir="rtl"] .custom-education-theme-faq-answer-inner,
    [dir="ltr"] .custom-education-theme-faq-answer-inner {
        padding: 14px 18px 18px;
        font-size: 0.84rem;
    }

    /* در موبایل زیرشاخه‌ها همیشه تمام عرض بشن */
    .custom-education-theme-faq-child {
        flex: 0 0 100%;
    }

    .custom-education-theme-faq-cta {
        padding: 22px 18px;
    }

        .custom-education-theme-faq-cta h3 {
            font-size: 1.05rem;
        }

    .custom-education-theme-faq-cta-btn {
        width: 100%;
        justify-content: center;
    }
}
