<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php 
        echo (isset($globalSettings) && is_object($globalSettings) && !empty($globalSettings->site_title)) 
            ? htmlspecialchars($globalSettings->site_title) 
            : (defined('SITENAME') ? SITENAME : 'Emlak Web'); 
    ?></title>
    
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">

    <link rel="stylesheet" href="<?php echo BASE_URL; ?>/assets/css/style.css">

    <script src="https://cdn.tailwindcss.com"></script>
    <script>
        tailwind.config = {
            prefix: 'tw-', 
            theme: {
                extend: {
                    fontFamily: {
                        sans: ['"Plus Jakarta Sans"', 'sans-serif'],
                    },
                    colors: {
                        primary: '#0f172a', 
                        secondary: '#64748b',
                        accent: '#2563eb', /* Yeni tasarıma uyumlu mavi (eski kırmızı yerine) */
                        accentHover: '#1d4ed8',
                    },
                    boxShadow: {
                        'soft': '0 4px 20px -2px rgba(0, 0, 0, 0.05)',
                    }
                }
            }
        }
    </script>

    <style>
        body { font-family: 'Plus Jakarta Sans', sans-serif; }
        
        /* Navbar Geçişleri */
        .navbar { 
            transition: all 0.3s ease-in-out; 
            background-color: rgba(255, 255, 255, 0.95); 
            backdrop-filter: blur(8px);
            border-bottom: 1px solid rgba(0,0,0,0.05);
        }
        
        /* Scrolled Durumu */
        .navbar-scrolled {
            background-color: rgba(255, 255, 255, 0.98) !important;
            backdrop-filter: blur(12px);
            box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
            padding-top: 12px !important;
            padding-bottom: 12px !important;
        }

        /* Link Hover Efekti */
        .nav-link { position: relative; font-weight: 600; color: #475569 !important; }
        .nav-link::after {
            content: '';
            position: absolute;
            width: 0;
            height: 2px;
            bottom: 0;
            left: 50%;
            background-color: #2563eb;
            transition: all 0.3s ease;
            transform: translateX(-50%);
            border-radius: 2px;
        }
        .nav-link:hover { color: #0f172a !important; }
        .nav-link:hover::after { width: 100%; }
        .nav-link.active { color: #2563eb !important; }
        .nav-link.active::after { width: 100%; }
        
        @media (max-width: 991px) {
            .nav-link::after { display: none; }
            .top-bar-mobile-hide { display: none; }
        }
    </style>
</head>
<body class="d-flex flex-column min-vh-100 tw-bg-[#f8fafc]">

<div class="tw-bg-primary tw-text-gray-300 tw-text-xs tw-py-2.5 top-bar-mobile-hide tw-font-medium">
    <div class="container d-flex justify-content-between align-items-center">
        <div class="d-flex tw-gap-6">
            <a href="tel:<?php echo (isset($globalSettings) && !empty($globalSettings->phone)) ? preg_replace('/[^0-9+]/', '', $globalSettings->phone) : ''; ?>" class="d-flex align-items-center hover:tw-text-white tw-transition-colors text-decoration-none tw-text-gray-300">
                <i class="fa-solid fa-phone tw-mr-2 tw-text-blue-400"></i> 
                <?php echo (isset($globalSettings) && !empty($globalSettings->phone)) ? htmlspecialchars($globalSettings->phone) : '+90 555 000 00 00'; ?>
            </a>
            <a href="mailto:<?php echo (isset($globalSettings) && !empty($globalSettings->email)) ? htmlspecialchars($globalSettings->email) : ''; ?>" class="d-flex align-items-center hover:tw-text-white tw-transition-colors text-decoration-none tw-text-gray-300">
                <i class="fa-solid fa-envelope tw-mr-2 tw-text-blue-400"></i> 
                <?php echo (isset($globalSettings) && !empty($globalSettings->email)) ? htmlspecialchars($globalSettings->email) : 'info@emlakkonut.com'; ?>
            </a>
        </div>
        <div class="d-flex align-items-center tw-gap-4">
            <a href="contact" class="tw-text-gray-400 hover:tw-text-white tw-transition-colors text-decoration-none">Yardım Merkezi</a>
            <span class="tw-text-gray-600 tw-text-[10px]">|</span>
            <div class="d-flex tw-gap-3">
                <a href="<?php echo isset($globalSettings->facebook) ? $globalSettings->facebook : '#'; ?>" class="tw-text-gray-400 hover:tw-text-[#1877F2] tw-transition-colors"><i class="fa-brands fa-facebook-f"></i></a>
                <a href="<?php echo isset($globalSettings->instagram) ? $globalSettings->instagram : '#'; ?>" class="tw-text-gray-400 hover:tw-text-[#E4405F] tw-transition-colors"><i class="fa-brands fa-instagram"></i></a>
                <a href="<?php echo isset($globalSettings->twitter) ? $globalSettings->twitter : '#'; ?>" class="tw-text-gray-400 hover:tw-text-white tw-transition-colors"><i class="fa-brands fa-x-twitter"></i></a>
            </div>
        </div>
    </div>
</div>

<nav class="navbar navbar-expand-lg sticky-top tw-py-4" id="mainNavbar">
  <div class="container">
    
    <a class="navbar-brand d-flex align-items-center tw-gap-3" 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">
    <?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-primary tw-leading-none tw-tracking-tight tw-transition-colors">
            <?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-600 tw-tracking-[0.25em] tw-uppercase tw-mt-1">
            <?php 
                echo isset($parts[1]) ? htmlspecialchars($parts[1]) : 'GAYRİMENKUL'; 
            ?>
        </span>
    </div>
    </a>

    <button class="navbar-toggler tw-border-0 tw-shadow-none focus:tw-ring-0" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
      <span class="tw-text-primary tw-text-2xl"><i class="fa-solid fa-bars-staggered"></i></span>
    </button>
    
    <div class="collapse navbar-collapse" id="navbarNav">
      <ul class="navbar-nav mx-auto align-items-lg-center tw-gap-1 lg:tw-gap-6 tw-my-4 lg:tw-my-0 tw-px-3 lg:tw-px-0">
        <li class="nav-item">
            <a class="nav-link tw-py-2 lg:tw-py-0" href="<?php echo BASE_URL; ?>">Anasayfa</a>
        </li>
        <li class="nav-item">
            <a class="nav-link tw-py-2 lg:tw-py-0" href="<?php echo BASE_URL; ?>/properties">İlanlar</a>
        </li>
        <li class="nav-item">
            <a class="nav-link tw-py-2 lg:tw-py-0" href="<?php echo BASE_URL; ?>/projects">Projeler</a>
        </li>
        <li class="nav-item">
            <a class="nav-link tw-py-2 lg:tw-py-0" href="<?php echo BASE_URL; ?>/about">Kurumsal</a>
        </li>
        <li class="nav-item">
            <a class="nav-link tw-py-2 lg:tw-py-0" href="<?php echo BASE_URL; ?>/contact">İletişim</a>
        </li>
      </ul>

      <div class="d-flex align-items-lg-center tw-gap-3 flex-column flex-lg-row tw-px-3 lg:tw-px-0 tw-pb-4 lg:tw-pb-0">
          
        <div class="d-flex tw-gap-2">
            <a href="<?php echo BASE_URL; ?>/favorites" class="btn tw-bg-gray-100 hover:tw-bg-gray-200 tw-text-gray-700 tw-rounded-xl tw-p-2.5 tw-transition-colors" title="Favoriler">
                <i class="fa-regular fa-heart"></i>
            </a>
            <a href="<?php echo BASE_URL; ?>/compare" class="btn tw-bg-gray-100 hover:tw-bg-gray-200 tw-text-gray-700 tw-rounded-xl tw-p-2.5 tw-transition-colors" title="Karşılaştır">
                <i class="fa-solid fa-scale-balanced"></i>
            </a>
        </div>

        <a href="<?php echo BASE_URL; ?>/contact" class="btn tw-bg-blue-600 hover:tw-bg-blue-700 tw-text-white tw-font-bold tw-rounded-xl tw-px-6 tw-py-2.5 tw-shadow-lg tw-shadow-blue-500/30 tw-transition-all hover:tw--translate-y-0.5 tw-border-0 tw-w-full lg:tw-w-auto">
            <i class="fa-solid fa-paper-plane tw-mr-1.5"></i> Bize Ulaşın
        </a>
        
      </div>
    </div>
  </div>
</nav>

<script>
    // Navbar Scroll Efekti
    window.addEventListener('scroll', function() {
        const navbar = document.getElementById('mainNavbar');
        if (window.scrollY > 50) {
            navbar.classList.add('navbar-scrolled');
            navbar.classList.remove('tw-py-4');
        } else {
            navbar.classList.remove('navbar-scrolled');
            navbar.classList.add('tw-py-4');
        }
    });
</script>