<footer class="tw-bg-[#0f172a] tw-text-white tw-mt-auto tw-pt-16 tw-pb-8 tw-relative tw-overflow-hidden">
    
    <div class="tw-absolute tw-top-0 tw-left-0 tw-w-full tw-h-1.5 tw-bg-gradient-to-r tw-from-blue-600 tw-via-teal-400 tw-to-blue-600"></div>

    <div class="container tw-relative tw-z-10">
        <div class="row gy-5">
            
            <div class="col-lg-4 col-md-6">
                <a class="navbar-brand d-flex align-items-center tw-gap-3 tw-mb-6 text-decoration-none" href="<?php echo BASE_URL; ?>">
                    <?php 
                    $siteTitle = !empty($globalSettings->site_title) ? $globalSettings->site_title : (defined('SITENAME') ? SITENAME : 'EMLAK');
                    $logoUrl = (!empty($globalSettings->site_logo)) ? BASE_URL . '/' . $globalSettings->site_logo : '';
                    ?>

                    <?php if (!empty($logoUrl)): ?>
                        <img src="<?php echo $logoUrl; ?>" 
                             alt="<?php echo htmlspecialchars($siteTitle); ?>"
                             class="tw-h-10 lg:tw-h-12 tw-w-auto tw-object-contain tw-brightness-0 tw-invert"> 
                    <?php else: ?>
                        <div class="tw-bg-gradient-to-br tw-from-blue-600 tw-to-indigo-700 tw-text-white tw-rounded-[12px] tw-w-10 tw-h-10 lg:tw-w-12 lg:tw-h-12 d-flex align-items-center justify-content-center tw-shadow-lg tw-shadow-blue-500/30">
                            <i class="fa-solid fa-building-user tw-text-xl"></i>
                        </div>
                    <?php endif; ?>

                    <div class="d-flex flex-column">
                        <span class="tw-font-black tw-text-xl lg:tw-text-2xl tw-text-white tw-leading-none tw-tracking-tight">
                            <?php 
                                $parts = explode(' ', trim($siteTitle));
                                echo htmlspecialchars($parts[0]); 
                            ?>
                        </span>
                        <span class="tw-text-[9px] lg:tw-text-[10px] tw-font-bold tw-text-blue-500 tw-tracking-[0.25em] tw-uppercase tw-mt-1">
                            <?php echo isset($parts[1]) ? htmlspecialchars($parts[1]) : 'GAYRİMENKUL'; ?>
                        </span>
                    </div>
                </a>

                <p class="tw-text-slate-400 tw-text-sm tw-leading-relaxed tw-mb-6 tw-pr-4">
                    Gayrimenkul sektöründe güven ve kalitenin adresi. Hayalinizdeki evi bulmanız için profesyonel danışmanlık hizmeti sunuyoruz.
                </p>
                
                <div class="d-flex tw-gap-3">
    <?php 
        $socials = [
            ['icon' => 'fa-facebook-f', 'link' => $globalSettings->facebook ?? '#', 'hover' => 'hover:tw-bg-[#1877F2]'],
            ['icon' => 'fa-twitter', 'link' => $globalSettings->twitter ?? '#', 'hover' => 'hover:tw-bg-white hover:tw-text-gray-900'],
            ['icon' => 'fa-instagram', 'link' => $globalSettings->instagram ?? '#', 'hover' => 'hover:tw-bg-gradient-to-tr hover:tw-from-[#f09433] hover:tw-via-[#dc2743] hover:tw-to-[#bc1888]']
        ];
        foreach($socials as $social): 
    ?>
        <a href="<?php echo $social['link']; ?>" target="_blank" class="text-decoration-none tw-w-10 tw-h-10 tw-rounded-xl tw-bg-slate-800 tw-flex tw-items-center tw-justify-center tw-text-slate-400 tw-transition-all hover:tw-text-white <?php echo $social['hover']; ?> hover:tw--translate-y-1">
            <i class="fa-brands <?php echo $social['icon']; ?> tw-text-lg"></i>
        </a>
    <?php endforeach; ?>
</div>
            </div>

            <div class="col-lg-2 col-md-6">
                <h5 class="tw-font-black tw-text-white tw-mb-6 tw-text-sm tw-uppercase tw-tracking-widest">Kurumsal</h5>
                <ul class="list-unstyled tw-space-y-4">
                    <li><a href="<?php echo BASE_URL; ?>" class="tw-text-slate-400 hover:tw-text-white tw-text-sm tw-no-underline tw-transition-all hover:tw-translate-x-1.5 d-inline-block">Anasayfa</a></li>
                    <li><a href="<?php echo BASE_URL; ?>/about" class="tw-text-slate-400 hover:tw-text-white tw-text-sm tw-no-underline tw-transition-all hover:tw-translate-x-1.5 d-inline-block">Hakkımızda</a></li>
                    <li><a href="<?php echo BASE_URL; ?>/contact" class="tw-text-slate-400 hover:tw-text-white tw-text-sm tw-no-underline tw-transition-all hover:tw-translate-x-1.5 d-inline-block">İletişim</a></li>
                </ul>
            </div>

            <div class="col-lg-2 col-md-6">
                <h5 class="tw-font-black tw-text-white tw-mb-6 tw-text-sm tw-uppercase tw-tracking-widest">İlanlar</h5>
                <ul class="list-unstyled tw-space-y-4">
                    <li><a href="<?php echo BASE_URL; ?>/properties?category=sale" class="tw-text-slate-400 hover:tw-text-white tw-text-sm tw-no-underline tw-transition-all hover:tw-translate-x-1.5 d-inline-block">Satılık İlanlar</a></li>
                    <li><a href="<?php echo BASE_URL; ?>/properties?category=rent" class="tw-text-slate-400 hover:tw-text-white tw-text-sm tw-no-underline tw-transition-all hover:tw-translate-x-1.5 d-inline-block">Kiralık İlanlar</a></li>
                    <li><a href="<?php echo BASE_URL; ?>/projects" class="tw-text-slate-400 hover:tw-text-white tw-text-sm tw-no-underline tw-transition-all hover:tw-translate-x-1.5 d-inline-block">Yeni Projeler</a></li>
                </ul>
            </div>

            <div class="col-lg-4 col-md-6">
                <h5 class="tw-font-black tw-text-white tw-mb-6 tw-text-sm tw-uppercase tw-tracking-widest">Bize Ulaşın</h5>
                
                <ul class="list-unstyled tw-space-y-4 tw-mb-8">
                    <li class="d-flex align-items-center tw-gap-3">
                        <i class="fa-solid fa-phone tw-text-blue-500 tw-w-5"></i>
                        <a href="tel:<?php echo $globalSettings->phone ?? ''; ?>" class="tw-text-slate-400 hover:tw-text-white tw-text-sm tw-no-underline"><?php echo $globalSettings->phone ?? 'İletişim yok'; ?></a>
                    </li>
                    <li class="d-flex align-items-center tw-gap-3">
                        <i class="fa-solid fa-envelope tw-text-blue-500 tw-w-5"></i>
                        <a href="mailto:<?php echo $globalSettings->email ?? ''; ?>" class="tw-text-slate-400 hover:tw-text-white tw-text-sm tw-no-underline"><?php echo $globalSettings->email ?? 'E-posta yok'; ?></a>
                    </li>
                </ul>

                <div class="tw-bg-slate-800/40 tw-p-5 tw-rounded-[2rem] tw-border tw-border-slate-700/50">
                    <p class="tw-text-[10px] tw-text-slate-400 tw-font-black tw-uppercase tw-tracking-[0.2em] tw-mb-4">E-Bültene Katılın</p>
                    <div class="tw-flex tw-bg-slate-900 tw-rounded-2xl tw-p-1.5 tw-border tw-border-slate-700 focus-within:tw-border-blue-500/50 tw-transition-all">
                        <input type="email" 
                               class="tw-flex-1 tw-bg-transparent tw-border-0 tw-text-white tw-text-sm tw-px-4 focus:tw-outline-none focus:tw-ring-0 placeholder:tw-text-slate-600" 
                               placeholder="E-posta adresiniz">
                        <button class="tw-bg-blue-600 hover:tw-bg-blue-700 tw-text-white tw-w-11 tw-h-11 tw-rounded-xl tw-flex tw-items-center tw-justify-center tw-transition-all active:tw-scale-95 shadow-lg shadow-blue-500/20" 
                                type="button">
                            <i class="fa-solid fa-paper-plane tw-text-sm"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>

        <hr class="tw-border-slate-800 tw-my-10">

        <div class="d-flex flex-column flex-md-row justify-content-between align-items-center tw-text-xs">
            <div class="tw-text-slate-500 mb-3 mb-md-0">
                &copy; <?php echo date('Y'); ?> <span class="tw-text-white tw-font-semibold"><?php echo htmlspecialchars($siteTitle); ?></span>. Tüm hakları saklıdır.
            </div>
            <div class="tw-flex tw-gap-6 tw-font-medium">
                <a href="#" class="tw-text-slate-500 hover:tw-text-white tw-no-underline">Gizlilik</a>
                <a href="#" class="tw-text-slate-500 hover:tw-text-white tw-no-underline">Şartlar</a>
                <a href="#" class="tw-text-slate-500 hover:tw-text-white tw-no-underline">Çerezler</a>
            </div>
        </div>
    </div>
</footer>

<button id="scrollToTopBtn" class="tw-fixed tw-bottom-8 tw-right-8 tw-bg-blue-600 hover:tw-bg-blue-700 tw-text-white tw-w-12 tw-h-12 tw-rounded-full tw-shadow-xl tw-shadow-blue-500/30 tw-border-0 tw-hidden tw-items-center tw-justify-center tw-z-50 tw-transition-all hover:tw--translate-y-1">
    <i class="fa-solid fa-arrow-up"></i>
</button>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>

<script>
    const scrollBtn = document.getElementById("scrollToTopBtn");
    window.onscroll = function() {
        if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 300) {
            scrollBtn.classList.remove("tw-hidden");
            scrollBtn.classList.add("tw-flex");
        } else {
            scrollBtn.classList.add("tw-hidden");
            scrollBtn.classList.remove("tw-flex");
        }
    };
    scrollBtn.addEventListener("click", () => {
        window.scrollTo({ top: 0, behavior: "smooth" });
    });
</script>
</body>
</html>