<?php
$class = isset($args['class']) ? $args['class'] : '';
?>


<section class="section advance-features <?php echo $class;?>">
    <div class="container">
        <div class="text-cont">
            <h2 class="section-title"><?php echo get_field('advanced_features_faqs_section_heading');?></h2>
        </div>
        <div class="row">
            <div class="col-lg-6 col-md-12">
                <?php
                // Check rows exists.
                if( have_rows('advanced_features_faqs_repeatar') ): 
                    $faq = 1;
                ?>
                <div class="accordion-cont">

                    <div class="accordion" id="advancedFaqsExample">
                    <?php 
                    // Loop through rows.
                    while( have_rows('advanced_features_faqs_repeatar') ) : the_row();?>
                        <div class="accordion-item">
                            <h2 class="accordion-header" id="heading-<?php echo $faq;?>">
                                <button class="accordion-button <?php echo $faq == 1 ? '' : 'collapsed';?>" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-<?php echo $faq;?>" aria-expanded="<?php echo $faq == 1 ? 'true' : 'false';?>" aria-controls="collapse-<?php echo $faq;?>">
                                    <?php echo get_sub_field('advanced_features_faqs_repeatar_faq_title')?>
                                </button>
                            </h2>
                            <div id="collapse-<?php echo $faq;?>" class="accordion-collapse collapse <?php echo $faq == 1 ? 'show' : '';?> " aria-labelledby="heading-<?php echo $faq;?>" data-bs-parent="#advancedFaqsExample">
                                <div class="accordion-body">
                                    <?php echo get_sub_field('advanced_features_faqs_repeatar_faq_faq_text')?>
                                </div>
                            </div>
                        </div>
                        <?php 
                        $faq++;
                        endwhile;?>
                    </div>
                </div>
                <?php endif;?>
            </div>
            <div class="col-lg-6 col-md-12">
                <div class="img-cont text-center">
                    <img src="<?php echo get_field('advanced_features_faqs_section_image');?>" alt="features" class="img-fluid">
                </div>
            </div>
        </div>
    </div>
</section>