// FAQ Accordion Styles
.ps-faq-wrapper {
    max-width: 100%;
    margin: 0 auto;

    .ps-faq-header {
        text-align: center;
        margin-bottom: 2rem;

        .ps-faq-title {
            font-size: 1.75rem;
            font-weight: 700;
            color: $color-heading;
            margin-bottom: 0.5rem;
        }

        .ps-faq-subtitle {
            font-size: 0.95rem;
            color: #6c757d;
            margin-bottom: 0;
        }
    }

    .ps-faq-accordion {
        .ps-faq-item {
            border: 1px solid #e8e8e8;
            border-radius: 8px;
            margin-bottom: 1rem;
            overflow: hidden;
            transition: all 0.3s ease;
            background: #fff;

            &:hover {
                border-color: #d1d1d1;
                box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
            }

            &.first-item {
                .ps-faq-question:not(.collapsed) {
                    border-top-left-radius: 7px;
                    border-top-right-radius: 7px;
                }
            }

            &:last-child {
                margin-bottom: 0;
            }

            .accordion-header {
                margin-bottom: 0;
            }

            .ps-faq-question {
                display: flex;
                align-items: center;
                width: 100%;
                padding: 1.25rem 1.5rem;
                font-size: 1rem;
                font-weight: 600;
                color: $color-heading;
                text-align: left;
                background-color: #fafafa;
                border: none;
                border-radius: 0;
                transition: all 0.4s ease;
                position: relative;
                box-shadow: none !important;

                // Disable default Bootstrap accordion arrow
                &::after {
                    display: none !important;
                }

                &:hover {
                    background-color: #f0f0f0;
                    box-shadow: none !important;
                }

                &:focus {
                    box-shadow: none !important;
                    outline: none;
                }

                &:not(.collapsed) {
                    background-color: $color-1st;
                    color: $color-heading;
                    box-shadow: none !important;

                    .ps-faq-icon i {
                        color: $color-heading;
                    }

                    .ps-faq-toggle-icon i {
                        transform: rotate(180deg);
                        color: $color-heading;
                    }
                }

                &.collapsed {
                    .ps-faq-icon i {
                        color: $color-heading;
                    }

                    .ps-faq-toggle-icon i {
                        color: $color-heading;
                    }
                }

                .ps-faq-icon {
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    flex-shrink: 0;
                    margin-right: 1rem;

                    i {
                        font-size: 1.25rem;
                        transition: color 0.4s ease;
                    }
                }

                .ps-faq-question-text {
                    flex: 1;
                    line-height: 1.5;
                    text-align: start;
                }

                .ps-faq-toggle-icon {
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    flex-shrink: 0;

                    i {
                        font-size: 1rem;
                        transition: transform 0.4s ease, color 0.4s ease;
                    }
                }
            }

            .accordion-collapse {
                border-top: 1px solid #e8e8e8;
            }

            .ps-faq-answer {
                padding: 1.5rem 1.5rem 1.5rem 4rem;
                background-color: #fff;

                .ps-faq-answer-content {
                    font-size: 0.95rem;
                    line-height: 1.7;
                    color: #555;

                    p {
                        margin-bottom: 0.75rem;

                        &:last-child {
                            margin-bottom: 0;
                        }
                    }

                    ul, ol {
                        margin-bottom: 0.75rem;
                        padding-left: 1.5rem;

                        &:last-child {
                            margin-bottom: 0;
                        }

                        li {
                            margin-bottom: 0.5rem;

                            &:last-child {
                                margin-bottom: 0;
                            }
                        }
                    }

                    a {
                        color: $color-1st;
                        text-decoration: none;
                        font-weight: 500;
                        transition: color 0.2s ease, opacity 0.2s ease;

                        &:hover {
                            opacity: 0.8;
                            text-decoration: underline;
                        }
                    }

                    strong, b {
                        font-weight: 600;
                        color: $color-heading;
                    }

                    em, i {
                        font-style: italic;
                    }

                    code {
                        background-color: #f5f5f5;
                        padding: 0.2rem 0.4rem;
                        border-radius: 3px;
                        font-size: 0.9em;
                        color: #e83e8c;
                    }
                }
            }
        }
    }
}

// Responsive styles
@media (max-width: 767px) {
    .ps-faq-wrapper {
        .ps-faq-header {
            .ps-faq-title {
                font-size: 1.5rem;
            }

            .ps-faq-subtitle {
                font-size: 0.9rem;
            }
        }

        .ps-faq-accordion {
            .ps-faq-item {
                margin-bottom: 0.75rem;

                .ps-faq-question {
                    padding: 1rem 1.25rem;
                    font-size: 0.95rem;

                    .ps-faq-icon {
                        margin-right: 0.75rem;

                        i {
                            font-size: 1.1rem;
                        }
                    }

                    .ps-faq-toggle-icon {
                        margin-left: 0.75rem;

                        i {
                            font-size: 0.9rem;
                        }
                    }
                }

                .ps-faq-answer {
                    padding: 1.25rem 1.25rem 1.25rem 3.25rem;

                    .ps-faq-answer-content {
                        font-size: 0.9rem;
                    }
                }
            }
        }
    }
}

@media (max-width: 575px) {
    .ps-faq-wrapper {
        .ps-faq-accordion {
            .ps-faq-item {
                .ps-faq-question {
                    padding: 0.875rem 1rem;
                    font-size: 0.9rem;

                    .ps-faq-icon {
                        display: none; // Hide icon on very small screens to save space
                    }
                }

                .ps-faq-answer {
                    padding: 1rem 1rem;
                }
            }
        }
    }
}

// RTL Support
[dir="rtl"] {
    .ps-faq-wrapper {
        .ps-faq-header {
            text-align: center;
        }

        .ps-faq-accordion {
            .ps-faq-item {
                .ps-faq-question {
                    text-align: right;

                    .ps-faq-icon {
                        margin-right: 0;
                        margin-left: 1rem;
                    }

                    .ps-faq-question-text {
                        text-align: right;
                    }
                }

                .ps-faq-answer {
                    padding: 1.5rem 4rem 1.5rem 1.5rem;

                    .ps-faq-answer-content {
                        text-align: right;
                        direction: rtl;

                        ul, ol {
                            padding-left: 0;
                            padding-right: 1.5rem;
                        }
                    }
                }
            }
        }
    }

    // RTL Responsive styles
    @media (max-width: 767px) {
        .ps-faq-wrapper {
            .ps-faq-accordion {
                .ps-faq-item {
                    .ps-faq-question {
                        .ps-faq-icon {
                            margin-right: 0;
                            margin-left: 0.75rem;
                        }
                    }

                    .ps-faq-answer {
                        padding: 1.25rem 3.25rem 1.25rem 1.25rem;
                    }
                }
            }
        }
    }

    @media (max-width: 575px) {
        .ps-faq-wrapper {
            .ps-faq-accordion {
                .ps-faq-item {
                    .ps-faq-answer {
                        padding: 1rem 1rem;
                    }
                }
            }
        }
    }
}
