<?php
// Fetch services for sidebar
if (!function_exists('get_db_connection')) {
    require_once $_SERVER['DOCUMENT_ROOT'] . '/config.php';
}
$conn = get_db_connection();
$sidebar_services_result = $conn->query("SELECT DISTINCT * FROM services ORDER BY display_order ASC, name ASC");
$sidebar_services = [];
$service_ids = []; // Track unique service IDs
if ($sidebar_services_result) {
    while ($row = $sidebar_services_result->fetch_assoc()) {
        $service_id = (int)$row['id'];
        // Only add if we haven't seen this ID before
        if (!in_array($service_id, $service_ids)) {
            $sidebar_services[] = $row;
            $service_ids[] = $service_id;
        }
    }
}
?>
<div class="elementor-widget-wrap elementor-element-populated">
                                <section
                                    class="elementor-section elementor-inner-section elementor-element elementor-element-a4835d9 elementor-section-full_width elementor-section-height-default elementor-section-height-default"
                                    data-id="a4835d9" data-element_type="section">
                                    <div class="elementor-container elementor-column-gap-default">
                                        <div class="elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-9122c42"
                                            data-id="9122c42" data-element_type="column">
                                            <div class="elementor-widget-wrap elementor-element-populated">
                                                <div class="elementor-element elementor-element-66081ca elementor-widget__width-initial elementor-widget elementor-widget-image"
                                                    data-id="66081ca" data-element_type="widget"
                                                    data-widget_type="image.default">
                                                    <div class="elementor-widget-container"> <img fetchpriority="high"
                                                            decoding="async" width="1000" height="1000"
                                                            src="/wp-content/uploads/2023/12/expertise-icon.png"
                                                            data-src="/wp-content/uploads/2023/12/expertise-icon.png"
                                                            class="attachment-full size-full wp-image-1890 lazyloaded"
                                                            alt="Expertise Icon"
                                                            data-srcset="/wp-content/uploads/2023/12/expertise-icon.png 1000w, /wp-content/uploads/2023/12/expertise-icon-300x300.png 300w, /wp-content/uploads/2023/12/expertise-icon-150x150.png 150w, /wp-content/uploads/2023/12/expertise-icon-768x768.png 768w"
                                                            sizes="(max-width: 1000px) 100vw, 1000px"
                                                            srcset="/wp-content/uploads/2023/12/expertise-icon.png 1000w, /wp-content/uploads/2023/12/expertise-icon-300x300.png 300w, /wp-content/uploads/2023/12/expertise-icon-150x150.png 150w, /wp-content/uploads/2023/12/expertise-icon-768x768.png 768w"><noscript><img
                                                                decoding="async" width="1000" height="1000"
                                                                src="/wp-content/uploads/2023/12/expertise-icon.png"
                                                                class="attachment-full size-full wp-image-1890 lazyload"
                                                                alt="Expertise Icon"
                                                                srcset="/wp-content/uploads/2023/12/expertise-icon.png 1000w, /wp-content/uploads/2023/12/expertise-icon-300x300.png 300w, /wp-content/uploads/2023/12/expertise-icon-150x150.png 150w, /wp-content/uploads/2023/12/expertise-icon-768x768.png 768w"
                                                                sizes="(max-width: 1000px) 100vw, 1000px" /></noscript>
                                                    </div>
                                                </div>
                                                <div class="elementor-element elementor-element-ea41de3 elementor-widget__width-initial elementor-widget elementor-widget-image"
                                                    data-id="ea41de3" data-element_type="widget"
                                                    data-widget_type="image.default">
                                                    <div class="elementor-widget-container"> <img decoding="async"
                                                            width="500" height="500"
                                                            src="/wp-content/uploads/2022/10/customer-top-priority.png"
                                                            data-src="/wp-content/uploads/2022/10/customer-top-priority.png"
                                                            class="attachment-full size-full wp-image-1210 lazyloaded"
                                                            alt="Customer Top Priority"
                                                            data-srcset="/wp-content/uploads/2022/10/customer-top-priority.png 500w, /wp-content/uploads/2022/10/customer-top-priority-300x300.png 300w, /wp-content/uploads/2022/10/customer-top-priority-150x150.png 150w"
                                                            sizes="(max-width: 500px) 100vw, 500px"
                                                            srcset="/wp-content/uploads/2022/10/customer-top-priority.png 500w, /wp-content/uploads/2022/10/customer-top-priority-300x300.png 300w, /wp-content/uploads/2022/10/customer-top-priority-150x150.png 150w"><noscript><img
                                                                loading="lazy" decoding="async" width="500" height="500"
                                                                src="/wp-content/uploads/2022/10/customer-top-priority.png"
                                                                class="attachment-full size-full wp-image-1210 lazyload"
                                                                alt="Customer Top Priority"
                                                                srcset="/wp-content/uploads/2022/10/customer-top-priority.png 500w, /wp-content/uploads/2022/10/customer-top-priority-300x300.png 300w, /wp-content/uploads/2022/10/customer-top-priority-150x150.png 150w"
                                                                sizes="(max-width: 500px) 100vw, 500px" /></noscript>
                                                    </div>
                                                </div>
                                                <div class="elementor-element elementor-element-3deafd6 elementor-widget__width-initial elementor-widget elementor-widget-image"
                                                    data-id="3deafd6" data-element_type="widget"
                                                    data-widget_type="image.default">
                                                    <div class="elementor-widget-container"> <img loading="lazy"
                                                            decoding="async" width="500" height="500"
                                                            src="/wp-content/uploads/2022/10/100-percent-satisfaction.png"
                                                            data-src="/wp-content/uploads/2022/10/100-percent-satisfaction.png"
                                                            class="attachment-full size-full wp-image-1209 lazyloaded"
                                                            alt="100% Satisfaction"
                                                            data-srcset="/wp-content/uploads/2022/10/100-percent-satisfaction.png 500w, /wp-content/uploads/2022/10/100-percent-satisfaction-300x300.png 300w, /wp-content/uploads/2022/10/100-percent-satisfaction-150x150.png 150w"
                                                            sizes="(max-width: 500px) 100vw, 500px"
                                                            srcset="/wp-content/uploads/2022/10/100-percent-satisfaction.png 500w, /wp-content/uploads/2022/10/100-percent-satisfaction-300x300.png 300w, /wp-content/uploads/2022/10/100-percent-satisfaction-150x150.png 150w"><noscript><img
                                                                loading="lazy" decoding="async" width="500" height="500"
                                                                src="/wp-content/uploads/2022/10/100-percent-satisfaction.png"
                                                                class="attachment-full size-full wp-image-1209 lazyload"
                                                                alt="100% Satisfaction"
                                                                srcset="/wp-content/uploads/2022/10/100-percent-satisfaction.png 500w, /wp-content/uploads/2022/10/100-percent-satisfaction-300x300.png 300w, /wp-content/uploads/2022/10/100-percent-satisfaction-150x150.png 150w"
                                                                sizes="(max-width: 500px) 100vw, 500px" /></noscript>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </section>
                                <section
                                    class="elementor-section elementor-inner-section elementor-element elementor-element-40ab332 elementor-section-full_width elementor-section-height-default elementor-section-height-default"
                                    data-id="40ab332" data-element_type="section">
                                    <div class="elementor-container elementor-column-gap-default">
                                        <div class="elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-a512ebb"
                                            data-id="a512ebb" data-element_type="column">
                                            <div class="elementor-widget-wrap elementor-element-populated">
                                                <div class="elementor-element elementor-element-7dffcd3 elementor-widget elementor-widget-heading"
                                                    data-id="7dffcd3" data-element_type="widget"
                                                    data-widget_type="heading.default">
                                                    <div class="elementor-widget-container">
                                                        <h2 class="elementor-heading-title elementor-size-default">
                                                            Contact Info</h2>
                                                    </div>
                                                </div>
                                                <div class="elementor-element elementor-element-4a56f52 elementor-position-left elementor-vertical-align-middle elementor-widget-tablet__width-initial elementor-widget-mobile__width-inherit contact-box elementor-widget elementor-widget-image-box"
                                                    data-id="4a56f52" data-element_type="widget"
                                                    data-widget_type="image-box.default">
                                                    <div class="elementor-widget-container">
                                                        <div class="elementor-image-box-wrapper">
                                                            <figure class="elementor-image-box-img"><img loading="lazy"
                                                                    decoding="async" width="1500" height="1500"
                                                                    src="/wp-content/uploads/2022/09/a1-chimney-phone-icon.png"
                                                                    data-src="/wp-content/uploads/2022/09/a1-chimney-phone-icon.png"
                                                                    class="attachment-full size-full wp-image-828 ls-is-cached lazyloaded"
                                                                    alt="<?php echo get_website_name(); ?> Phone"><noscript><img loading="lazy"
                                                                        decoding="async" width="1500" height="1500"
                                                                        src="/wp-content/uploads/2022/09/a1-chimney-phone-icon.png"
                                                                        class="attachment-full size-full wp-image-828 lazyload"
                                                                        alt="<?php echo get_website_name(); ?> Phone"
                                                                        srcset="/wp-content/uploads/2022/09/a1-chimney-phone-icon.png 1500w, /wp-content/uploads/2022/09/a1-chimney-phone-icon-300x300.png 300w, /wp-content/uploads/2022/09/a1-chimney-phone-icon-1024x1024.png 1024w, /wp-content/uploads/2022/09/a1-chimney-phone-icon-150x150.png 150w, /wp-content/uploads/2022/09/a1-chimney-phone-icon-768x768.png 768w"
                                                                        sizes="(max-width: 1500px) 100vw, 1500px" /></noscript>
                                                            </figure>
                                                            <div class="elementor-image-box-content">
                                                                <h3 class="elementor-image-box-title">Phone Number:</h3>
                                                                <p class="elementor-image-box-description"><a
                                                                        href="tel:<?php echo get_phone_number_tel(); ?>"><?php echo get_phone_number(); ?></a></p>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="elementor-element elementor-element-b863511 elementor-position-left elementor-vertical-align-middle elementor-widget-tablet__width-initial elementor-widget-mobile__width-inherit contact-box elementor-widget elementor-widget-image-box"
                                                    data-id="b863511" data-element_type="widget"
                                                    data-widget_type="image-box.default">
                                                    <div class="elementor-widget-container">
                                                        <div class="elementor-image-box-wrapper">
                                                            <figure class="elementor-image-box-img"><img loading="lazy"
                                                                    decoding="async" width="1500" height="1500"
                                                                    src="/wp-content/uploads/2022/09/a1-chimney-email-icon.png"
                                                                    data-src="/wp-content/uploads/2022/09/a1-chimney-email-icon.png"
                                                                    class="attachment-full size-full wp-image-829 ls-is-cached lazyloaded"
                                                                    alt="<?php echo get_website_name(); ?> Email"><noscript><img loading="lazy"
                                                                        decoding="async" width="1500" height="1500"
                                                                        src="/wp-content/uploads/2022/09/a1-chimney-email-icon.png"
                                                                        class="attachment-full size-full wp-image-829 lazyload"
                                                                        alt="<?php echo get_website_name(); ?> Email"
                                                                        srcset="/wp-content/uploads/2022/09/a1-chimney-email-icon.png 1500w, /wp-content/uploads/2022/09/a1-chimney-email-icon-300x300.png 300w, /wp-content/uploads/2022/09/a1-chimney-email-icon-1024x1024.png 1024w, /wp-content/uploads/2022/09/a1-chimney-email-icon-150x150.png 150w, /wp-content/uploads/2022/09/a1-chimney-email-icon-768x768.png 768w"
                                                                        sizes="(max-width: 1500px) 100vw, 1500px" /></noscript>
                                                            </figure>
                                                            <div class="elementor-image-box-content">
                                                                <h3 class="elementor-image-box-title">Email Address:
                                                                </h3>
                                                                <p class="elementor-image-box-description"><a
                                                                        href="mailto:<?php echo get_email(); ?>"><?php echo get_email(); ?></a>
                                                                </p>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="elementor-element elementor-element-260979a elementor-position-left elementor-vertical-align-middle elementor-widget-tablet__width-initial elementor-widget-mobile__width-inherit contact-box elementor-widget elementor-widget-image-box"
                                                    data-id="260979a" data-element_type="widget"
                                                    data-widget_type="image-box.default">
                                                    <div class="elementor-widget-container">
                                                        <div class="elementor-image-box-wrapper">
                                                            <figure class="elementor-image-box-img"><img loading="lazy"
                                                                    decoding="async" width="1500" height="1500"
                                                                    src="/wp-content/uploads/2022/09/a1-chimney-location-icon.png"
                                                                    data-src="/wp-content/uploads/2022/09/a1-chimney-location-icon.png"
                                                                    class="attachment-full size-full wp-image-830 ls-is-cached lazyloaded"
                                                                    alt="<?php echo get_website_name(); ?> Location"><noscript><img
                                                                        loading="lazy" decoding="async" width="1500"
                                                                        height="1500"
                                                                        src="/wp-content/uploads/2022/09/a1-chimney-location-icon.png"
                                                                        class="attachment-full size-full wp-image-830 lazyload"
                                                                        alt="<?php echo get_website_name(); ?> Location"
                                                                        srcset="/wp-content/uploads/2022/09/a1-chimney-location-icon.png 1500w, /wp-content/uploads/2022/09/a1-chimney-location-icon-300x300.png 300w, /wp-content/uploads/2022/09/a1-chimney-location-icon-1024x1024.png 1024w, /wp-content/uploads/2022/09/a1-chimney-location-icon-150x150.png 150w, /wp-content/uploads/2022/09/a1-chimney-location-icon-768x768.png 768w"
                                                                        sizes="(max-width: 1500px) 100vw, 1500px" /></noscript>
                                                            </figure>
                                                            <div class="elementor-image-box-content">
                                                                <h3 class="elementor-image-box-title">Service Area:</h3>
                                                                <p class="elementor-image-box-description">Serving the
                                                                    Local Area</p>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </section>
                              

                                <section
                                    class="elementor-section elementor-inner-section elementor-element elementor-element-be08a39 elementor-section-full_width elementor-section-height-default elementor-section-height-default"
                                    data-id="be08a39" data-element_type="section">
                                    <div class="elementor-container elementor-column-gap-default">
                                        <div class="elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-1240bf6"
                                            data-id="1240bf6" data-element_type="column">
                                            <div class="elementor-widget-wrap elementor-element-populated">
                                                <div class="elementor-element elementor-element-5b87a1e elementor-widget elementor-widget-heading"
                                                    data-id="5b87a1e" data-element_type="widget"
                                                    data-widget_type="heading.default">
                                                    <div class="elementor-widget-container">
                                                        <h2 class="elementor-heading-title elementor-size-default">Our
                                                            Services</h2>
                                                    </div>
                                                </div>
                                                <div class="elementor-element elementor-element-1cb47ca elementor-nav-menu--dropdown-none elementor-widget elementor-widget-nav-menu"
                                                    data-id="1cb47ca" data-element_type="widget"
                                                    data-settings="{&quot;layout&quot;:&quot;vertical&quot;,&quot;submenu_icon&quot;:{&quot;value&quot;:&quot;&lt;i class=\&quot;fas fa-caret-down\&quot;&gt;&lt;\/i&gt;&quot;,&quot;library&quot;:&quot;fa-solid&quot;}}"
                                                    data-widget_type="nav-menu.default">
                                                    <div class="elementor-widget-container">
                                                        <nav aria-label="Menu"
                                                            class="elementor-nav-menu--main elementor-nav-menu__container elementor-nav-menu--layout-vertical e--pointer-background e--animation-fade">
                                                            <ul id="menu-1-1cb47ca"
                                                                class="elementor-nav-menu sm-vertical"
                                                                data-smartmenus-id="17691398049717356">
                                                                <?php foreach ($sidebar_services as $index => $service): 
                                                                    $service_link = '/service.php?slug=' . urlencode($service['slug']);
                                                                ?>
                                                                <li class="menu-item menu-item-type-post_type menu-item-object-page">
                                                                    <a href="<?php echo htmlspecialchars($service_link); ?>"
                                                                        class="elementor-item"><?php echo htmlspecialchars($service['name']); ?></a></li>
                                                                <?php endforeach; ?>
                                                            </ul>
                                                        </nav>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </section>
                            </div>
