<section class="testimonials__area pt-115 pb-100">
    <div class="container">
        <div class="row">
            <div class="col-xxl-6 offset-xxl-3">
                <div class="section__title-wrapper text-center mb-60">
                    <h2 class="section__title">
                        <?php echo esc_html( get_theme_mod( 'educrap_Testimonials_Section_Title', __( 'What Our Students Say', 'educrap' ) ) ); ?>
                    </h2>
                    <p>
                        <?php echo esc_html( get_theme_mod( 'educrap_Testimonials_Section_Description', __( 'Real feedback from students and parents who trust Educrap for a better learning journey.', 'educrap' ) ) ); ?>
                    </p>
                </div>
            </div>
        </div>

        <div class="row">
            <?php
            $testimonial_items = array(
                array(
                    'quote' => get_theme_mod( 'educrap_Testimonial_1_Quote', __( 'The classes are very engaging and the teachers are always supportive. I improved a lot in a short time.', 'educrap' ) ),
                    'name'  => get_theme_mod( 'educrap_Testimonial_1_Name', __( 'Aarav Sharma', 'educrap' ) ),
                    'role'  => get_theme_mod( 'educrap_Testimonial_1_Role', __( 'Student', 'educrap' ) ),
                    'image' => get_theme_mod( 'educrap_Testimonial_1_Image' ),
                ),
                array(
                    'quote' => get_theme_mod( 'educrap_Testimonial_2_Quote', __( 'A perfect place for learning with a friendly environment and excellent guidance.', 'educrap' ) ),
                    'name'  => get_theme_mod( 'educrap_Testimonial_2_Name', __( 'Meera Patel', 'educrap' ) ),
                    'role'  => get_theme_mod( 'educrap_Testimonial_2_Role', __( 'Parent', 'educrap' ) ),
                    'image' => get_theme_mod( 'educrap_Testimonial_2_Image' ),
                ),
                array(
                    'quote' => get_theme_mod( 'educrap_Testimonial_3_Quote', __( 'The platform is simple, modern and very helpful for students who want to grow confidently.', 'educrap' ) ),
                    'name'  => get_theme_mod( 'educrap_Testimonial_3_Name', __( 'Rohan Verma', 'educrap' ) ),
                    'role'  => get_theme_mod( 'educrap_Testimonial_3_Role', __( 'Student', 'educrap' ) ),
                    'image' => get_theme_mod( 'educrap_Testimonial_3_Image' ),
                ),
            );

            foreach ( $testimonial_items as $testimonial ) {
                $initial = strtoupper( substr( $testimonial['name'], 0, 1 ) );
                ?>
                <div class="col-xxl-4 col-xl-4 col-lg-4 col-md-6">
                    <div class="testimonial__item">
                        <div class="testimonial__quote">“</div>
                        <p><?php echo esc_html( $testimonial['quote'] ); ?></p>
                        <div class="testimonial__author d-flex align-items-center">
                            <?php if ( ! empty( $testimonial['image'] ) ) { ?>
                                <img src="<?php echo esc_url( $testimonial['image'] ); ?>" alt="<?php echo esc_attr( $testimonial['name'] ); ?>" class="testimonial__image">
                            <?php } else { ?>
                                <div class="testimonial__avatar">
                                    <span><?php echo esc_html( $initial ); ?></span>
                                </div>
                            <?php } ?>
                            <div class="testimonial__info">
                                <h4><?php echo esc_html( $testimonial['name'] ); ?></h4>
                                <span><?php echo esc_html( $testimonial['role'] ); ?></span>
                            </div>
                        </div>
                    </div>
                </div>
            <?php } ?>
        </div>
    </div>
</section>
