<?php
    // Page: Oferta
    // ID: 511

    get_header();


    $box_1 = get_field('box_1');
    $box_2 = get_field('box_2');
    $box_3_top = get_field('box_3_top');
    $box_3_bottom = get_field('box_3_bottom');
    $box_4_top = get_field('box_4_top');
    $box_4_bottom = get_field('box_4_bottom');
    $box_5 = get_field('box_5');
    $box_6 = get_field('box_6');
    $box_7 = get_field('box_7');
    $box_8 = get_field('box_8');
?>
<main id="primary" class="site-main">
    <section class="box-1">
        <div class="container">
            <div class="row">
                <div class="col-1">
                    <div id="box-page-name">
                        <?php echo get_the_title(); ?>
                    </div>
                    <div class="box-title">
                        <h2><?php echo $box_1['title']; ?></h2>
                    </div>
                    <div class="box-text">
                        <?php echo $box_1['text']; ?>
                    </div>
                    <div class="box-nav">
                        <?php if (!empty($box_1['links'])): ?>
                        <ul>
                            <?php foreach ($box_1['links'] as $link) : ?>
                                <?php
                                    $btn_color  = $link['btn_color'] ?? '';
                                ?>
                            <li>
                                <a href="<?php echo $link['btn']['url']; ?>" style="background-color: <?php echo $btn_color; ?>;">
                                    <span>
                                        <?php echo $link['btn']['title']; ?>
                                    </span>
                                </a>
                            </li>
                            <?php endforeach; ?>
                        </ul>
                        <?php endif; ?>
                    </div>
                </div>
                <div class="col-2">
                    <div class="box-img">
                        <img src="<?php echo $box_1['img']; ?>" alt="">
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section class="box-2" id="dla-placowek">
        <div class="box-bg">
            <img src="/wp-content/uploads/2025/11/Vector.svg" alt="">
        </div>
        <div class="container">
            <div class="row">
                <div class="col-1">
                    <div class="box-title">
                        <h2><?php echo $box_2['title']; ?></h2>
                    </div>
                    <div class="box-text">
                        <?php echo $box_2['text']; ?>
                    </div>
                    <div class="box-info-text">
                        <?php echo $box_2['info']; ?>
                    </div>
                </div>
                <div class="col-2">
                    <div class="box-img">
                        <img src="<?php echo $box_2['img']; ?>" alt="">
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section class="box-3" id="modul-1">
        <div class="box-bg">
            <img src="/wp-content/uploads/2025/11/Frame-355.svg" alt="">
        </div>
        <div class="container">
            <div class="box-3--wrapper">
                <div class="row row-1">
                    <div class="col col-1">
                        <?php if ($box_3_top['title']): ?>
                            <div class="box-title">
                                <h3><?php echo $box_3_top['title']; ?></h3>
                            </div>
                        <?php endif; ?>
                        <?php if ($box_3_top['description']): ?>
                            <div class="box-text-info">
                                <?php echo $box_3_top['description']; ?>
                            </div>
                        <?php endif; ?>
                        <?php if ($box_3_top['date']): ?>
                            <div class="box-data">
                                <p><?php echo $box_3_top['date']; ?></p>
                            </div>
                        <?php endif; ?>

                        <?php if (!empty($box_3_top['btn']['url']) || !empty($box_3_top['btn_2']['url'])) : ?>
                        <div class="box-btns">
                            <?php if(!empty($box_3_top['btn']['url'])) : ?>
                                <a href="<?php echo $box_3_top['btn']['url']; ?>" class="btn-4" target="<?php echo $box_3_top['btn']['target']; ?>">
                                    <span><?php echo $box_3_top['btn']['title']; ?></span>
                                </a>
                            <?php endif; ?>

                            <?php if(!empty($box_3_top['btn_2']['url'])) : ?>
                                <a href="<?php echo $box_3_top['btn_2']['url']; ?>" class="btn-4" target="<?php echo $box_3_top['btn_2']['target']; ?>">
                                    <span><?php echo $box_3_top['btn_2']['title']; ?></span>
                                </a>
                            <?php endif; ?>
                        </div>
                        <?php endif; ?>
                    </div>
                    <div class="col col-2">
                        <?php if ($box_3_top['text']): ?>
                            <div class="box-text">
                                <?php echo $box_3_top['text']; ?>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>

                <div class="row row-2">
                    <?php if ($box_3_bottom['title']): ?>
                        <div class="box-text">
                            <p><?php echo $box_3_bottom['title']; ?></p>
                        </div>
                    <?php endif; ?>
                </div>

                <div class="row row-3">
                    <div class="tiles-list">
                        <?php foreach($box_3_bottom['tiles'] as $tile): ?>
                        <div class="tile">
                            <?php if (!empty($tile['icon'])): ?>
                                <div class="tile-icon">
                                    <img src="<?php echo $tile['icon']; ?>" alt="">
                                </div>
                            <?php endif; ?>
                            <?php if (!empty($tile['title'])): ?>
                                <div class="tile-title">
                                    <h4><?php echo $tile['title']; ?></h4>
                                </div>
                            <?php endif; ?>
                            <?php if (!empty($tile['text'])): ?>
                                <div class="tile-text">
                                    <p><?php echo $tile['text']; ?></p>
                                </div>
                            <?php endif; ?>
                        </div>
                        <?php endforeach; ?>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section class="box-4" id="modul-2">
        <div class="box-bg">
            <img src="/wp-content/uploads/2025/11/Frame-356.svg" alt="">
        </div>
        <div class="container">
            <div class="box-4--wrapper">
                <div class="row row-1">
                    <div class="col col-1">
                        <?php if ($box_4_top['description']): ?>
                            <div class="box-text-info">
                                <?php echo $box_4_top['description']; ?>
                            </div>
                        <?php endif; ?>
                        <?php if ($box_4_top['title']): ?>
                            <div class="box-title">
                                <h3><?php echo $box_4_top['title']; ?></h3>
                            </div>
                        <?php endif; ?>
                        <?php if ($box_4_top['date']): ?>
                            <div class="box-data">
                                <p><?php echo $box_4_top['date']; ?></p>
                            </div>
                        <?php endif; ?>
                        <?php if ($box_4_top['alert']): ?>
                            <div class="box-alert">
                                <p><?php echo $box_4_top['alert']; ?></p>
                            </div>
                        <?php endif; ?>
                        <?php if (!empty($box_4_top['btn']['url']) || !empty($box_4_top['btn_2']['url'])) : ?>
                        <div class="box-btns">
                            <?php if(!empty($box_4_top['btn']['url'])) : ?>
                                <a href="<?php echo $box_4_top['btn']['url']; ?>" class="btn-4" target="<?php echo $box_4_top['btn']['target']; ?>">
                                    <span><?php echo $box_4_top['btn']['title']; ?></span>
                                </a>
                            <?php endif; ?>

                            <?php if(!empty($box_4_top['btn_2']['url'])) : ?>
                                <a href="<?php echo $box_4_top['btn_2']['url']; ?>" class="btn-4" target="<?php echo $box_4_top['btn_2']['target']; ?>">
                                    <span><?php echo $box_4_top['btn_2']['title']; ?></span>
                                </a>
                            <?php endif; ?>
                        </div>
                        <?php endif; ?>
                    </div>
                    <div class="col col-2">
                        <?php if ($box_4_top['text']): ?>
                            <div class="box-text">
                                <?php echo $box_4_top['text']; ?>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>

                <div class="row row-2">
                    <?php if ($box_4_bottom['title']): ?>
                        <div class="box-text">
                            <p><?php echo $box_4_bottom['title']; ?></p>
                        </div>
                    <?php endif; ?>
                </div>

                <div class="row row-3">
                    <div class="tiles-list">
                        <?php foreach($box_4_bottom['tiles'] as $tile): ?>
                        <div class="tile">
                            <?php if (!empty($tile['icon'])): ?>
                                <div class="tile-icon">
                                    <img src="<?php echo $tile['icon']; ?>" alt="">
                                </div>
                            <?php endif; ?>
                            <?php if (!empty($tile['title'])): ?>
                                <div class="tile-title">
                                    <h4><?php echo $tile['title']; ?></h4>
                                </div>
                            <?php endif; ?>
                            <?php if (!empty($tile['text'])): ?>
                                <div class="tile-text">
                                    <p><?php echo $tile['text']; ?></p>
                                </div>
                            <?php endif; ?>
                        </div>
                        <?php endforeach; ?>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section class="box-5" id="dla-indywidualnych">
        <div class="box-bg">
            <img src="/wp-content/uploads/2025/11/Vector-1.svg" alt="">
        </div>
        <div class="container">
            <div class="row">
                <div class="col-1">
                    <div class="box-title">
                        <h2><?php echo $box_5['title']; ?></h2>
                    </div>
                    <div class="box-text">
                        <?php echo $box_5['text']; ?>
                    </div>
                    <div class="box-info-text">
                        <?php echo $box_5['info']; ?>
                    </div>
                    <?php if ($box_5['btn']['title']): ?>
                    <div class="box-nav">
                        <ul>
                            <li>
                                <a href="<?php echo $box_5['btn']['url']; ?>"><?php echo $box_5['btn']['title']; ?></a>
                            </li>
                        </ul>
                    </div>
                    <?php endif; ?>
                </div>
                <div class="col-2">
                    <div class="box-img">
                        <img src="<?php echo $box_5['img']; ?>" alt="">
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section class="box-6">
        <div class="container">
            <div class="box-6-wrapper">
                <?php if($box_6['title']): ?>
                    <div class="row row-1">
                        <div class="box-title">
                            <h2><?php echo $box_6['title']; ?></h2>
                        </div>
                    </div>
                <?php endif; ?>
                <div class="row row-2">
                    <div class="modules-tiles">
                        <?php foreach($box_6['tiles'] as $tile): ?>
                            <div class="module-tile">
                                <?php if($tile['description']): ?>
                                    <div class="module-tile--info">
                                        <?php echo $tile['description']; ?>
                                    </div>
                                <?php endif; ?>

                                <?php if($tile['title']): ?>
                                    <div class="module-tile--title">
                                        <h3><?php echo $tile['title']; ?></h3>
                                    </div>
                                <?php endif; ?>

                                <?php if($tile['text']): ?>
                                    <div class="module-tile--content">
                                        <div class="module-tile--content--texts">
                                            <?php echo $tile['text']; ?>
                                        </div>
                                    </div>
                                <?php endif; ?>

                                <div class="module-tile--nav">
                                    <nav>
                                        <?php if($tile['text']): ?>
                                            <button class="module-tile--btn">
                                                <span class="text-more">Rozwiń program</span>
                                                <span class="text-less" style="display: none;">Zwiń program</span>
                                                <img src="/wp-content/uploads/2025/11/CaretDown.svg" alt="">
                                            </button>
                                        <?php else: ?>
                                            <span></span>
                                        <?php endif; ?>

                                        <?php if(!empty($tile['extra_buttons'])) : ?>
                                            <div class="module-tile--nav--btns">
                                                <?php foreach($tile['extra_buttons'] as $btn): ?>
                                                    <?php if(!empty($btn['btn']['url'])) : ?>
                                                        <a href="<?php echo $btn['btn']['url']; ?>" class="btn-4" target="<?php echo $btn['btn']['target']; ?>">
                                                            <span><?php echo $btn['btn']['title']; ?></span>
                                                        </a>
                                                    <?php endif; ?>
                                                <?php endforeach; ?>
                                            </div>
                                        <?php endif; ?>
                                    </nav>

                                    <?php if($tile['access']): ?>
                                        <div class="module-tile--access">
                                            <p><?php echo $tile['access']; ?></p>
                                        </div>
                                    <?php endif; ?>
                                </div>
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section class="box-7" id="superwizje">
        <div class="box-bg">
            <img src="/wp-content/uploads/2025/11/Vector-2.svg" alt="">
        </div>
        <div class="container">
            <div class="row">
                <div class="col col-1">
                    <div class="box-img">
                        <img src="<?php echo $box_7['img']; ?>" alt="">
                    </div>
                </div>
                <div class="col col-2">
                    <div class="box-title">
                        <h2><?php echo $box_7['title']; ?></h2>
                    </div>
                    <div class="box-text">
                        <?php echo $box_7['text']; ?>
                    </div>
                    
                    <div class="box-info">
                        <p><?php echo $box_7['info']; ?></p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section class="box-8">
        <div class="box-bg">
            <img src="/wp-content/uploads/2025/10/img-7.svg" alt="">
        </div>
        <div class="container">
            <div class="row">
                <div class="col col-1">
                    <div class="box-title">
                        <h2><?php echo $box_8['title']; ?></h2>
                    </div>
                    <div class="box-text">
                        <?php echo $box_8['text']; ?>
                    </div>
                    <ul class="box-nav">
                        <li>
                            <?php if ($box_8['btn']['title']): ?>
                            <a class="btn-3" href="<?php echo $box_8['btn']['url']; ?>"><?php echo $box_8['btn']['title']; ?></a>
                            <?php endif; ?>
                        </li>
                    </ul>
                </div>
                <div class="col col-2">
                    <div class="box-img">
                        <img src="<?php echo $box_8['img']; ?>" alt="">
                    </div>
                </div>
            </div>
        </div>
    </section>
</main>
<?php get_footer(); ?>