176669 policies in database
Link to program      
2026-03-01
bzkyapi.com logo
Thank
Gift
HOF
Reward

bzkyapi.com

A vulnerability disclosure policy (VDP), also referred to as a responsible disclosure policy, describes how an organization will handle reports of vulnerabilities submitted by ethical hackers. A VDP must thus be easily identifiable via a simple way, a security.txt notice.

<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Bozkurt İnşaat - BZK Yapı İzmir | Lüks Villa Daire Konut Projeleri</title>
    
    <!-- ✅ SEO Meta Etiketleri - Optimize Edilmiş -->
    <meta name="description" content="BZK Yapı - Bozkurt İnşaat İzmir'de lüks villa, modern daire ve prestijli konut projeleri. İzmir'in en güvenilir müteahhit firması. 20 yıllık tecrübe, kaliteli inşaat ve zamanında teslim garantisi.">
    <meta name="keywords" content="bozkurt inşaat, bzk inşaat, bzk yapı, bzk yapi, bozkurt yapı, izmir villa, izmir daire, lüks konut izmir, lüks villa izmir, modern daire izmir, prestijli konut, izmir inşaat firması, izmir müteahhit, güvenilir inşaat, kaliteli konut, izmir lüks projeler, villa projeleri izmir, daire projeleri izmir">
    <meta name="author" content="Bozkurt İnşaat - BZK Yapı">
    <meta name="robots" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1">
    <link rel="canonical" href="https://www.bzkyapi.com/">
    
    <!-- Open Graph / Facebook -->
    <meta property="og:type" content="website">
    <meta property="og:url" content="https://www.bzkyapi.com/">
    <meta property="og:title" content="Bozkurt İnşaat - BZK Yapı İzmir | Lüks Villa Daire Konut Projeleri">
    <meta property="og:description" content="İzmir'de lüks villa, modern daire ve prestijli konut projeleri. 20 yıllık tecrübe ile güvenilir inşaat.">
    <meta property="og:image" content="https://www.bzkyapi.com/og-image.jpg">
    
    <!-- Twitter -->
    <meta property="twitter:card" content="summary_large_image">
    <meta property="twitter:url" content="https://www.bzkyapi.com/">
    <meta property="twitter:title" content="Bozkurt İnşaat - BZK Yapı İzmir | Lüks Villa Daire">
    <meta property="twitter:description" content="İzmir'de lüks villa, modern daire ve prestijli konut projeleri.">
    <meta property="twitter:image" content="https://www.bzkyapi.com/twitter-image.jpg">

    
    <!-- Favicon -->
    <link rel="icon" type="image/png" href="/favicon.png">
    <link rel="apple-touch-icon" href="/apple-touch-icon.png">
     <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "RealEstateAgent",
      "name": "Bozkurt İnşaat - BZK Yapı",
      "alternateName": ["BZK İnşaat", "BZK Yapı", "Bozkurt Yapı"],
      "url": "https://www.bzkyapi.com",
      "logo": "https://www.bzkyapi.com/logo.png",
      "description": "İzmir'de lüks villa, modern daire ve prestijli konut projeleri sunan güvenilir inşaat firması. 20 yıllık tecrübe ile kaliteli ve zamanında teslim.",
      "address": {
        "@type": "PostalAddress",
        "addressLocality": "İzmir",
        "addressRegion": "İzmir",
        "addressCountry": "TR"
      },
      "contactPoint": {
        "@type": "ContactPoint",
        "telephone": "+90-232-XXX-XX-XX",
        "contactType": "Customer Service",
        "areaServed": "TR",
        "availableLanguage": ["Turkish"]
      },
      "sameAs": [
        "https://www.facebook.com/bzkyapi",
        "https://www.instagram.com/bzkyapi",
        "https://www.linkedin.com/company/bzkyapi"
      ],
      "aggregateRating": {
        "@type": "AggregateRating",
        "ratingValue": "4.8",
        "reviewCount": "127"
      },
      "priceRange": "₺₺₺",
      "makesOffer": [
        {
          "@type": "Offer",
          "itemOffered": {
            "@type": "Product",
            "name": "Lüks Villa Projeleri İzmir"
          }
        },
        {
          "@type": "Offer",
          "itemOffered": {
            "@type": "Product",
            "name": "Modern Daire Projeleri İzmir"
          }
        }
      ]
    }
    </script>
    <!-- Tailwind CSS Yüklemesi -->
    <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <script src="https://cdn.tailwindcss.com"></script>
    
    <!-- ═══════════════════════════════════════════════════════════════════ -->
    <!-- 🎨 WHITE LABEL CONFIG - Müşteriye özel ayarlar bu dosyada -->
    <!-- ═══════════════════════════════════════════════════════════════════ -->
    <script src="site-config.js"></script>
    
    <script type="module">
    // ...
    import { initializeApp } from "https://www.gstatic.com/firebasejs/11.6.1/firebase-app.js";
    import { getAuth, onAuthStateChanged, signInWithEmailAndPassword, signOut } from "https://www.gstatic.com/firebasejs/11.6.1/firebase-auth.js";
    import { getDatabase, ref, get, set, remove, onValue } from "https://www.gstatic.com/firebasejs/11.6.1/firebase-database.js";
    </script>
    <!-- Lucide Icons -->
    <script src="https://unpkg.com/lucide@latest"></script>
    <style>
/* İnter Fontu ve Ana Renkler */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');

body {
    font-family: 'Inter', sans-serif;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #FACC15 #0F172A;
}

/* ✅ Site Geneli Scroll Performansı - project-modal gibi */
body::-webkit-scrollbar {
    width: 10px;
}

body::-webkit-scrollbar-track {
    background: #0F172A;
    border-radius: 10px;
}

body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #FACC15, #F59E0B);
    border-radius: 10px;
    border: 2px solid #0F172A;
}

body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #FDE047, #FACC15);
}

.elite-bg { background-color: #0F172A; }
.elite-text { color: #FACC15; }
.elite-border { border-color: #FACC15; }

.section-separator {
    content: '';
    display: block;
    width: 80px;
    height: 3px;
    background-color: #FACC15;
    margin: 1rem 0;
    border-radius: 9999px;
}

/* 🚀 GPU Acceleration - Kritik elementler için */
.hero-pin-bg,
.modal,
.card-hover {
    will-change: auto; /* Sürekli will-change yerine otomatik */
}

/* Scrollbar Gizleme */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Line Clamp Utilities */
.line-clamp-1 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}
.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.line-clamp-3 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Custom Scrollbar for Modal */
.scrollbar-custom {
    scrollbar-width: thin;
    scrollbar-color: #FACC15 #1E293B;
}
.scrollbar-custom::-webkit-scrollbar {
    width: 8px;
}
.scrollbar-custom::-webkit-scrollbar-track {
    background: #1E293B;
    border-radius: 10px;
}
.scrollbar-custom::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #FACC15, #F59E0B);
    border-radius: 10px;
}
.scrollbar-custom::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #FDE047, #FACC15);
}

/* Thumbnail Gallery Responsive Widths - Tam Sığma */
.thumbnail-item {
    aspect-ratio: 4/4.5; /* Kareye yakın, modern görünüm */
}

@media (min-width: 768px) and (max-width: 1023px) {
    /* Tablet: 2 thumbnail yan yana - TAM SIĞDIRILDI */
    .thumbnail-item {
        width: calc(48% - 0.5rem);
        min-width: calc(48% - 0.5rem);
    }
}

@media (min-width: 1024px) {
    /* Desktop: 3 thumbnail yan yana - TAM SIĞDIRILDI */
    .thumbnail-item {
        width: calc(31% - 0.67rem);
        min-width: calc(31% - 0.67rem);
    }
}

/* Hero ve Genel Efektler - ✅ PERFORMANS OPTİMİZE */
.hero-pin-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* Mobil için dinamik viewport height */
    background-color: #1E293B;
    z-index: -1;
}

/* 🔧 MOBİL FIX - Position fixed yerine absolute kullan */
@media (max-width: 768px) {
    .hero-pin-bg {
        position: absolute;
        height: 100%;
    }
}

.hero-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.content-overlay {
    position: relative;
    z-index: 10;
}

/* ✅ PERFORMANS BOOST - Sadece desktop'ta seçici transition */
@media (min-width: 769px) {
    /* ❌ KALDIRILDI: * { transition-duration: 0.15s !important; } */
    /* ✅ Sadece interaktif elementlerde transition */
    button:not(.remove-image-btn),
    a,
    input:focus,
    textarea:focus,
    select:focus {
        transition: opacity 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    }
}

/* ✅ Sadece önemli elementlerde smooth transition */
.card-hover {
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.modal {
    transition: opacity 0.3s ease;
}

button:not(.remove-image-btn):not(.card-nav-btn):not(.details-btn),
a {
    transition: opacity 0.2s ease;
}

/* ✅ Details Button - Minimal & Performant */
.details-btn {
    transition: background-color 0.15s ease;
    will-change: auto;
}

.details-btn:hover {
    background-color: #FDE047; /* yellow-300 */
}

.details-btn:active {
    background-color: #FACC15; /* yellow-500 */
}

/* ✅ Card Navigation Buttons - Performant */
.card-nav-btn {
    transition: background-color 0.15s ease, opacity 0.15s ease;
    will-change: auto;
    -webkit-tap-highlight-color: transparent;
}

/* ✅ Mobile Touch Feedback */
@media (max-width: 768px) {
    .card-nav-btn:active {
        background-color: #FACC15 !important;
        color: #0F172A !important;
    }
    
    .details-btn:active {
        transform: scale(0.98);
    }
}

input,
textarea,
select {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ✅ YENİ - Basit Hover Efekti (Scale YOK) */
.card-hover {
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.card-hover:hover {
    box-shadow: 0 8px 24px rgba(250, 204, 21, 0.2);
}

/* ✅ Transform animasyonlarını devre dışı bırak */
.group:hover .transform,
.transform:hover {
    transform: none !important;
}

/* ✅ Buton hover - sadece opacity */
button:hover,
a:hover {
    opacity: 0.9;
}

/* ✅ Görsel hover animasyonlarını kaldır */
img {
    transition: none !important;
}

.group:hover img {
    transform: none !important;
    filter: none !important;
}

/* 🚀 MOBİL OPTİMİZASYON - Gecikmeleri azalt */
@media (max-width: 768px) {
    /* ✅ Scroll animasyonlarını tamamen devre dışı bırak */
    [data-scroll-animate] {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
    
    /* ✅ Delay'leri sıfırla */
    [data-scroll-delay="100"],
    [data-scroll-delay="200"], 
    [data-scroll-delay="400"] {
        animation-delay: 0ms !important;
    }
    
    /* ✅ Backdrop filter'ı kaldır (performans) */
    .modern-header,
    .hero-content,
    [style*="backdrop-filter"] {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background-color: rgba(15, 23, 42, 0.95) !important;
    }
    
    /* ✅ Transition sürelerini minimize et */
    .card-hover,
    button,
    a {
        transition-duration: 0.1s !important;
    }
    
    /* ✅ Transform animasyonlarını kapat - CAROUSEL HARİÇ */
    *:not([id*="-carousel"]):not(.carousel-item) {
        /* transform: none !important; - KALDIRILDI, carousel'ları bozuyordu */
    }
    
    /* ✅ Detayları Gör butonu için özel fix */
    .details-button,
    button[onclick*="openProjectModal"] {
        opacity: 1 !important;
        animation: none !important;
    }
    
    /* ✅ KART CAROUSEL OKLARI - Mobilde her zaman görünür */
    .scroll-snap-card .group-hover\:opacity-100 {
        opacity: 1 !important;
    }
    
    /* ✅ Carousel okları mobilde daha büyük tıklama alanı */
    .scroll-snap-card button[onclick*="cardCarousel"] {
        opacity: 0.9 !important;
        padding: 0.75rem !important;
    }
}

/* ✅ Reduced Motion Desteği */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ✅ GPU Acceleration - Sadece carousel için */
.carousel-item,
#project-carousel {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ✅ Kart Carousel - Mobilde transform koruması */
[id*="-carousel"] {
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform;
}

/* ✅ Carousel Container - Touch davranışı */
.scroll-snap-card .relative.overflow-hidden {
    touch-action: pan-y pinch-zoom;
}

/* ✅ MOBİL: Dikey sıralama, normal scroll */
.horizontal-scroll-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0 1rem;
    overflow: visible;
}

.scroll-snap-card {
    width: 100%;
    max-width: none;
    margin: 0;
}

/* ✅ MOBİL: Kartlar daha geniş ve padding minimal */
@media (max-width: 767px) {
    .horizontal-scroll-container {
        padding: 0 0.5rem;
    }
    
    .scroll-snap-card,
    .horizontal-scroll-container > div {
        min-width: 100%;
    }
    
    .scroll-snap-card {
        margin: 0 auto;
        max-width: 100%;
    }
}

/* ✅ TABLET için 3 sütun GRID LAYOUT (768px - 1023px) */
@media (min-width: 768px) {
    .horizontal-scroll-container {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
        overflow-x: visible;
        overflow-y: visible;
        cursor: default;
        padding: 0 2rem;
        scroll-snap-type: none;
        scroll-padding: 0;
    }
    
    .scroll-snap-card {
        flex: none;
        width: 100%;
        min-width: auto;
        max-width: none;
        scroll-snap-align: unset;
        scroll-snap-stop: unset;
    }
}

/* ✅ MASAÜSTÜ için 4 sütun GRID LAYOUT (1024px+) */
@media (min-width: 1024px) {
    .horizontal-scroll-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
        max-width: 1400px;
        margin: 0 auto;
        padding: 0 3rem;
    }
}

/* ✅ Çok büyük ekranlar için (1536px+) */
@media (min-width: 1536px) {
    .horizontal-scroll-container {
        max-width: 1600px;
        gap: 2.5rem;
    }
}

/* ✅ SCROLL İZOLASYONU - Basit ve güvenilir yöntem */
html.modal-open,
body.modal-open {
    overflow: hidden !important;
    touch-action: none;
}

/* iOS Safari için ek düzeltme */
body.modal-open {
    position: relative;
}

/* Modal içeriği kendi scroll'una sahip olacak */
#project-modal {
    overscroll-behavior: contain;
}

#project-modal .modal-scroll-container {
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    max-height: 100vh;
    max-height: 100dvh;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 🎨 CSS DEĞİŞKENLERİ - WHITE LABEL TEMA SİSTEMİ */
/* ═══════════════════════════════════════════════════════════════════════════ */
:root {
    --color-brand: #FACC15;
    --color-brand-dark: #F59E0B;
    --color-brand-light: #FDE047;
    --color-bg: #0F172A;
    --color-bg-light: #1E293B;
    --color-bg-card: #334155;
    --color-text: #FFFFFF;
    --color-text-muted: #94A3B8;
    --color-text-dark: #0F172A;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 🎛️ ADMIN PANEL - SIDEBAR LAYOUT */
/* ═══════════════════════════════════════════════════════════════════════════ */

.admin-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 300;
    background: var(--color-bg);
    transition: opacity 0.3s ease;
    overflow: hidden;
}

/* Sidebar */
.admin-sidebar {
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, var(--color-bg-light) 0%, var(--color-bg) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
    z-index: 50;
    flex-shrink: 0;
}

/* Sidebar collapsed state (mobil) */
@media (max-width: 1023px) {
    .admin-sidebar {
        position: fixed;
        left: -280px;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }
    
    .admin-sidebar.open {
        left: 0;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

/* Sidebar Menü Öğeleri */
.admin-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
}

.admin-menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text);
}

.admin-menu-item.active {
    background: linear-gradient(90deg, rgba(250, 204, 21, 0.15) 0%, transparent 100%);
    color: var(--color-brand);
}

.admin-menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--color-brand);
    border-radius: 0 3px 3px 0;
}

/* Badge'ler */
.admin-badge {
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--color-bg);
    color: var(--color-text-muted);
    border-radius: 9999px;
}

.admin-badge-alert {
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    background: #EF4444;
    color: white;
    border-radius: 9999px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Ana İçerik Alanı */
.admin-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-bg);
}

/* Top Bar */
.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(180deg, var(--color-bg-light) 0%, transparent 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Bölümler */
.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hızlı İşlem Butonları */
.admin-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.25rem;
    background: var(--color-bg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.admin-quick-action:hover {
    background: rgba(250, 204, 21, 0.1);
    border-color: rgba(250, 204, 21, 0.3);
    color: var(--color-brand);
    transform: translateY(-2px);
}

/* Tema Butonları */
.theme-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--color-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.theme-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
}

.theme-btn.active {
    border-color: var(--color-brand);
    background: rgba(250, 204, 21, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 🎨 ADMIN ORTAK STİLLER */
/* ═══════════════════════════════════════════════════════════════════════════ */

.hidden-view {
    display: none;
    opacity: 0;
}

.visible-view {
    display: block;
    opacity: 1;
}

/* Admin Panel Kartları */
.admin-card {
    background: linear-gradient(145deg, var(--color-bg-light) 0%, var(--color-bg) 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.admin-card:hover {
    border-color: rgba(250, 204, 21, 0.2);
}

/* Admin Tablo Stilleri */
.admin-table {
    width: 100%;
}

.admin-table thead {
    background: rgba(255, 255, 255, 0.02);
}

.admin-table th {
    color: var(--color-brand);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1.5rem;
    font-size: 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.admin-table tbody tr {
    transition: background 0.2s ease;
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ✅ Admin Form Inputs */
.admin-input {
    background: var(--color-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    color: white;
    padding: 0.875rem 1rem;
    transition: all 0.2s ease;
}

.admin-input:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.1);
    outline: none;
}

.admin-input::placeholder {
    color: #64748B;
}

/* ✅ Admin Butonları */
.admin-btn-primary {
    background: linear-gradient(135deg, var(--color-brand) 0%, var(--color-brand-dark) 100%);
    color: var(--color-text-dark);
    font-weight: 700;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(250, 204, 21, 0.2);
    font-size: 0.875rem;
}

.admin-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(250, 204, 21, 0.3);
}

.admin-btn-secondary {
    background: var(--color-bg-light);
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.admin-btn-secondary:hover {
    border-color: rgba(250, 204, 21, 0.3);
    background: var(--color-bg-card);
}

.admin-btn-danger {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.admin-btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* ✅ Admin Stats Cards */
.admin-stat-card {
    background: var(--color-bg-light);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.admin-stat-card:hover {
    border-color: rgba(250, 204, 21, 0.2);
}

.admin-stat-number {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

/* Drag & Drop Alanı Stilleri */
#image-drop-zone {
    border: 2px dashed #475569;
    background: linear-gradient(180deg, #0F172A 0%, #1E293B 100%);
    transition: all 0.3s ease;
    border-radius: 1rem;
}

#image-drop-zone:hover {
    border-color: rgba(250, 204, 21, 0.5);
    background: linear-gradient(180deg, #1E293B 0%, #334155 100%);
}

#image-drop-zone.dragover {
    border-color: #FACC15;
    background: linear-gradient(180deg, #334155 0%, #475569 100%);
    box-shadow: 0 0 20px rgba(250, 204, 21, 0.2);
}

.preview-image-container {
    position: relative;
    width: 80px;
    height: 80px;
    background-color: #475569;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.preview-image-container:hover {
    border-color: rgba(250, 204, 21, 0.5);
    transform: scale(1.05);
}

.preview-image-container img {
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #ef4444;
    color: white;
    border-radius: 9999px;
    width: 20px;
    height: 20px;
    line-height: 1;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.15s;
}

.remove-image-btn:hover {
    background-color: #dc2626;
}

/* ✅ MODERN HEADER - PERFORMANS OPTİMİZE */
.modern-header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(250, 204, 21, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.2s ease;
}

.header-container {
    max-width: 1536px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (min-width: 640px) {
    .header-container {
        padding: 1rem 1.5rem;
    }
}

@media (min-width: 1024px) {
    .header-container {
        padding: 1rem 2rem;
    }
}

/* Logo Tasarımı */
.header-logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.header-logo:active {
    transform: scale(0.97);
}

.logo-icon-wrapper {
    width: 2.25rem;
    height: 2.25rem;
    background: linear-gradient(135deg, #FACC15 0%, #F59E0B 100%);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(250, 204, 21, 0.3);
    transition: all 0.2s ease;
}

@media (min-width: 640px) {
    .logo-icon-wrapper {
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 0.625rem;
    }
}

.header-logo:hover .logo-icon-wrapper {
    box-shadow: 0 4px 12px rgba(250, 204, 21, 0.5);
    transform: rotate(-5deg) scale(1.05);
}

.logo-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: #0F172A;
    stroke-width: 2.5;
}

@media (min-width: 640px) {
    .logo-icon {
        width: 1.5rem;
        height: 1.5rem;
    }
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 800;
    color: #FACC15;
    letter-spacing: 0.08em;
    transition: color 0.2s ease;
}

@media (min-width: 640px) {
    .logo-text {
        font-size: 1.25rem;
        letter-spacing: 0.1em;
    }
}

.header-logo:hover .logo-text {
    color: #FDE047;
}

/* Desktop Navigasyon */
.desktop-nav {
    display: none;
}

@media (min-width: 768px) {
    .desktop-nav {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
}

@media (min-width: 1024px) {
    .desktop-nav {
        gap: 1rem;
    }
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: #CBD5E1;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    position: relative;
}

@media (min-width: 1024px) {
    .nav-link {
        padding: 0.625rem 1.25rem;
        font-size: 1rem;
    }
}

.nav-link:hover {
    color: #FACC15;
    background: rgba(250, 204, 21, 0.1);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0.25rem;
    left: 50%;
    width: 0;
    height: 2px;
    background: #FACC15;
    transform: translateX(-50%);
    transition: width 0.2s ease;
}

.nav-link:hover::after {
    width: calc(100% - 2rem);
}

.nav-icon {
    width: 1.125rem;
    height: 1.125rem;
    stroke-width: 2;
}

/* Mobil Menu Button */
.mobile-menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(250, 204, 21, 0.1);
    border: 1px solid rgba(250, 204, 21, 0.2);
    border-radius: 0.5rem;
    color: #FACC15;
    cursor: pointer;
    transition: all 0.2s ease;
}

@media (min-width: 768px) {
    .mobile-menu-button {
        display: none;
    }
}

.mobile-menu-button:hover {
    background: rgba(250, 204, 21, 0.2);
    border-color: rgba(250, 204, 21, 0.4);
}

.mobile-menu-button:active {
    transform: scale(0.95);
}

.menu-icon {
    width: 1.5rem;
    height: 1.5rem;
    stroke-width: 2;
}

/* Mobil Menü */
.mobile-menu {
    background: rgba(15, 23, 42, 0.98);
    border-top: 1px solid rgba(250, 204, 21, 0.1);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

@media (min-width: 768px) {
    .mobile-menu {
        display: none !important;
    }
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    color: #CBD5E1;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
    transition: all 0.2s ease;
}

.mobile-nav-link:last-child {
    border-bottom: none;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
    background: rgba(250, 204, 21, 0.1);
    color: #FACC15;
    padding-left: 1.5rem;
}

.mobile-nav-icon {
    width: 1.25rem;
    height: 1.25rem;
    stroke-width: 2;
    flex-shrink: 0;
}

/* Scroll efekti */
@media (min-width: 768px) {
    .modern-header.scrolled {
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    }
}
@media (max-width: 768px) {
    section.min-h-screen {
        min-height: 100vh;
        min-height: 100dvh;
        padding-top: 4rem;
    }
    
    section.min-h-screen .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    section.min-h-screen .max-w-xl {
        padding: 1.5rem !important;
        margin-top: 2rem;
    }
    
    section.min-h-screen h1 {
        font-size: 2rem !important;
        line-height: 1.2;
    }
    
    header.sticky {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
}

/* ✅ HERO SECTION - PERFORMANS OPTİMİZE (MOBİL HIZLI) */
.hero-section {
    position: relative;
    padding: 1rem;
}

@media (min-width: 768px) {
    .hero-section {
        padding: 2rem;
    }
}

.hero-container {
    max-width: 100%;
    margin: 0;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .hero-container {
        padding: 0 2rem;
    }
}

@media (min-width: 768px) {
    .hero-container {
        max-width: 1280px;
        margin: 0 auto;
        padding: 0 3rem;
    }
}

.hero-content {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(250, 204, 21, 0.15);
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    position: relative;
}

@media (min-width: 640px) {
    .hero-content {
        padding: 2.5rem 2rem;
        border-radius: 1.25rem;
    }
}

@media (min-width: 768px) {
    .hero-content {
        padding: 3rem 2.5rem;
        max-width: 800px;
        background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.75) 100%);
        box-shadow: 
            0 10px 40px rgba(0, 0, 0, 0.5),
            0 0 30px rgba(250, 204, 21, 0.08);
    }
}

@media (min-width: 1024px) {
    .hero-content {
        padding: 4rem 3rem;
        max-width: 900px;
    }
}

/* Sadece desktop'ta hover efektleri */
@media (min-width: 768px) {
    .hero-content {
        transition: box-shadow 0.3s ease, border-color 0.3s ease;
    }
    
    .hero-content:hover {
        border-color: rgba(250, 204, 21, 0.3);
        box-shadow: 
            0 12px 48px rgba(0, 0, 0, 0.6),
            0 0 40px rgba(250, 204, 21, 0.12);
    }
}

.hero-subtitle {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    opacity: 0.9;
}

@media (min-width: 640px) {
    .hero-subtitle {
        font-size: 0.875rem;
    }
}

@media (min-width: 768px) {
    .hero-subtitle {
        font-size: 1rem;
        letter-spacing: 0.15em;
    }
}

.hero-title {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    line-height: 1.15;
}

@media (min-width: 768px) {
    .hero-title {
        text-shadow: 
            0 2px 10px rgba(0, 0, 0, 0.8),
            0 0 20px rgba(250, 204, 21, 0.2);
    }
}

.hero-description {
    max-width: 100%;
    opacity: 0.95;
}

@media (min-width: 768px) {
    .hero-description {
        max-width: 600px;
    }
}

.hero-cta {
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(250, 204, 21, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hero-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(250, 204, 21, 0.35);
}

.hero-cta:active {
    transform: translateY(0);
}

/* Section separator - basitleştirilmiş */
.hero-content .section-separator {
    background: linear-gradient(90deg, 
        transparent 0%, 
        #FACC15 20%, 
        #FACC15 80%, 
        transparent 100%);
    box-shadow: 0 0 6px rgba(250, 204, 21, 0.4);
}

/* ✅ HAKKIMIZDA SECTİON - MOBİL OPTİMİZE KARTLAR */
#hakkimizda .feature-card-container {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
    padding: 0 0.5rem;
}

@media (min-width: 640px) {
    #hakkimizda .feature-card-container {
        gap: 1.5rem;
        padding: 0;
    }
}

@media (min-width: 768px) {
    #hakkimizda .feature-card-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

#hakkimizda .feature-card {
    position: relative;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(51, 65, 85, 0.9) 100%);
    border: 1px solid rgba(71, 85, 105, 0.5);
    border-radius: 1rem;
    padding: 1.5rem;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

@media (min-width: 640px) {
    #hakkimizda .feature-card {
        padding: 2rem;
    }
}

#hakkimizda .feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(250, 204, 21, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* ✅ SADECE DESKTOP'TA HOVER (mobilde animasyon yok) */
@media (min-width: 768px) {
    #hakkimizda .feature-card:hover::before {
        opacity: 1;
    }

    #hakkimizda .feature-card:hover {
        transform: translateY(-8px) scale(1.02);
        box-shadow: 0 12px 40px rgba(250, 204, 21, 0.2), 0 0 0 2px rgba(250, 204, 21, 0.5);
        border-color: #FACC15;
        background: linear-gradient(135deg, rgba(51, 65, 85, 0.95) 0%, rgba(71, 85, 105, 0.95) 100%);
    }

    #hakkimizda .feature-card:hover .feature-icon {
        transform: scale(1.15) rotate(5deg);
    }
}

#hakkimizda .feature-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

@media (min-width: 640px) {
    #hakkimizda .feature-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
}

@media (min-width: 768px) {
    #hakkimizda .feature-title {
        font-size: 1.75rem;
    }
}

#hakkimizda .feature-description {
    color: rgba(203, 213, 225, 0.9);
    line-height: 1.6;
    font-size: 0.875rem;
}

@media (min-width: 640px) {
    #hakkimizda .feature-description {
        font-size: 0.9375rem;
        line-height: 1.7;
    }
}

@media (min-width: 768px) {
    #hakkimizda .feature-description {
        font-size: 1rem;
        line-height: 1.8;
    }
}
    
    header nav {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    header nav a.text-2xl {
        font-size: 1.25rem !important;
    }
    
    section.min-h-screen .absolute.bottom-10 {
        bottom: 2rem;
    }


/* ✅ Çok küçük ekranlar için (iPhone SE, vb.) */
@media (max-width: 375px) {
    section.min-h-screen h1 {
        font-size: 1.75rem !important;
    }
    
    section.min-h-screen p {
        font-size: 0.95rem !important;
    }
    
    section.min-h-screen a.inline-block {
        padding: 0.75rem 2rem !important;
        font-size: 0.95rem !important;
    }
}
    </style>
    <!-- Firebase Modülleri -->
    <script type="module">
        import { initializeApp } from "https://www.gstatic.com/firebasejs/11.6.1/firebase-app.js";
        import { getAuth, signInAnonymously, signInWithCustomToken, onAuthStateChanged, signOut,signInWithEmailAndPassword } from "https://www.gstatic.com/firebasejs/11.6.1/firebase-auth.js";
        import { initializeFirestore, collection, onSnapshot, setLogLevel, addDoc, doc, setDoc, deleteDoc, writeBatch, persistentLocalCache, persistentMultipleTabManager } from "https://www.gstatic.com/firebasejs/11.6.1/firebase-firestore.js";

        setLogLevel('debug');
        window.writeBatch = writeBatch;
        window.doc = doc;

        const firebaseConfigRaw = typeof __firebase_config !== 'undefined' ? __firebase_config : null;
        const initialAuthToken = typeof __initial_auth_token !== 'undefined' ? __initial_auth_token : null;

        let firebaseConfig = {};
        const PLACEHOLDER_PROJECT_ID = "abc";
        let appId = 'web-ce7b2'; // ✅ Direkt Firebase project ID'nizi yazın
        
        if (firebaseConfigRaw) {
            firebaseConfig = JSON.parse(firebaseConfigRaw);
            if (canvasAppId === 'default-app-id' && firebaseConfig.projectId) {
                appId = firebaseConfig.projectId;
            }
        } else {
            // 👇👇👇 BURAYA KENDİ GERÇEK FIREBASE YAPILANDIRMANIZI EKLEYİN 👇👇👇
            firebaseConfig = {
                // Sizin Firebase Konsolunuzdan kopyaladığınız 
                // gerçek config bilgileri buraya gelecek.
                apiKey: "AIzaSyCE86zO9qIRrtTbsvzQqm-0BXX4q3QkYF8",
                authDomain: "web-ce7b2.firebaseapp.com",
                projectId: "web-ce7b2",
                storageBucket: "web-ce7b2.firebasestorage.app",
                messagingSenderId: "386978872857",
                appId: "1:386978872857:web:f235f1f38b573b63d07488",
                measurementId: "G-RPB45EJ6V5",
                // ✅ Firestore için gerekli değil ama performans için eklenebilir
                databaseURL: "https://web-ce7b2-default-rtdb.firebaseio.com"
            };
            appId = firebaseConfig.projectId; 
            // 👆👆👆 BURAYA KENDİ GERÇEK FIREBASE YAPILANDIRMANIZI EKLEYİN 👆👆👆
        }
        
        const PROJECT_COLLECTION_PATH = `projects`;
        const INQUIRY_COLLECTION_PATH = `inquiries`;
        const CONTACT_INFO_PATH = `contact_info`;

        window.PROJECT_COLLECTION_PATH = PROJECT_COLLECTION_PATH;
        window.INQUIRY_COLLECTION_PATH = INQUIRY_COLLECTION_PATH;
        window.CONTACT_INFO_PATH = CONTACT_INFO_PATH;
        
        let db, auth;
        let projectsRef;
        let isAuthReady = false;

        // Global değişkenler
        window.projects = window.projects || []; 
        window.inquiries = window.inquiries || [];
        window.contactInfo = window.contactInfo || {};
        window.aboutUs = window.aboutUs || { title: '', content: '' }; // ✨ YENİ: Hakkımızda
        window.isAdminLoggedIn = window.isAdminLoggedIn || false; 
        // Base64 ve URL görsellerini modal açıkken tutmak için tek bir array
        window.currentProjectImages = []; 

        window.initFirebase = async () => {
    if (firebaseConfig.projectId === PLACEHOLDER_PROJECT_ID) {
         window.showMessage("🔴 FIREBASE YAPILANDIRMA HATASI: Lütfen index.html dosyasındaki ayarları doldurun.", 'bg-red-600', 8000);
         console.error("Firebase Config Hatası: Proje ID yer tutucu olarak kaldı. Veritabanı işlemleri devre dışı.");
         return; 
    }

    try {
        const app = initializeApp(firebaseConfig);
        
        // ✅ PERFORMANS BOOST: Persistent cache - İKİNCİ GİRİŞTE ANINDA YÜKLEME
        db = initializeFirestore(app, {
            localCache: persistentLocalCache({
                tabManager: persistentMultipleTabManager()
            })
        });
        
        auth = getAuth(app);
        window.auth = auth;
        window.db = db;
        
        projectsRef = collection(db, PROJECT_COLLECTION_PATH);

        // ✅ KRİTİK DEĞİŞİKLİK: Auth beklemeden public verileri dinle
        console.log("✅ Firebase başlatıldı - Public veriler yükleniyor (Auth beklenmiyor)...");
        
        // Public veriler için Auth gerekmez - hemen başlat
        listenToProjects(); 
        listenToContactInfo();
        listenToAboutUs();
        
        // Auth sadece admin işlemleri için
        onAuthStateChanged(auth, async (user) => {
            if (!user) {
                // Public sitede anonim giriş gerekmiyor, sadece admin için
                // await signInAnonymously(auth); // KALDIRILDI
                console.log("👤 Kullanıcı giriş yapmamış (public site için normal)");
            } else {
                console.log("👤 Kullanıcı giriş yaptı:", user.uid);
            }
            
            isAuthReady = true;
            window.isAuthReady = true;
            
            // Admin için inquiry dinleyicisini başlat
            if (user) {
                listenToInquiries();
            }
        });

    } catch (error) {
        window.showMessage(`🔴 Firebase Bağlantı Hatası: ${error.message}`, 'bg-red-600', 8000);
        console.error("Firebase Başlatma Hatası:", error);
    }
};

        // --- FIRESTORE READ İŞLEMİ (PUBLIC VE ADMIN İÇİN) ---
        function listenToProjects(){
            // ✅ HIZLI BAŞLANGIÇ: localStorage'dan önbelleği yükle
            const cachedProjects = localStorage.getItem('bzk_projects_cache');
            if (cachedProjects && window.projects.length === 0) {
                try {
                    window.projects = JSON.parse(cachedProjects);
                    window.renderProjects();
                    console.log("⚡ Projeler cache'den yüklendi (ANINDA render)");
                } catch (e) {
                    console.warn("Cache parse hatası:", e);
                }
            }

            onSnapshot(projectsRef, (snapshot) => {
                const fetchedProjects = [];
                snapshot.forEach(doc => {
                    fetchedProjects.push({ id: doc.id, ...doc.data() });
                });
                
                fetchedProjects.sort((a, b) => (b.year || 0) - (a.year || 0) || a.title.localeCompare(b.title));
                
                window.projects = fetchedProjects;
                
                // ✅ localStorage'a kaydet (bir sonraki açılış için)
                try {
                    localStorage.setItem('bzk_projects_cache', JSON.stringify(fetchedProjects));
                    console.log("💾 Projeler cache'e kaydedildi");
                } catch (e) {
                    console.warn("Cache kaydetme hatası (çok büyük olabilir):", e);
                }
                
                window.renderProjects(); // Public Site Render
                if (window.isAdminLoggedIn) {
                    window.renderAdminProjectTable(); // Admin Panel Render
                }
            }, (error) => {
                console.error("Firestore Hata:", error);
                window.showMessage(`Projeler yüklenirken hata oluştu: ${error.code}`, 'bg-red-600');
            });
        }
        // index.html dosyasında `listenToProjects()` fonksiyonundan sonra eklenmelidir.

function listenToInquiries(){
    if (!isAuthReady) return;

    const inquiriesRef = collection(db, INQUIRY_COLLECTION_PATH); // INQUIRY_COLLECTION_PATH'i kullanır

    onSnapshot(inquiriesRef, (snapshot) => {
        const fetchedInquiries = [];
        snapshot.forEach(doc => {
            fetchedInquiries.push({ id: doc.id, ...doc.data() });
        });
        
        // İstekleri en yeniye göre (timestamp) sıralayabilirsiniz
        fetchedInquiries.sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp));
        
        window.inquiries = fetchedInquiries;
        
        // Sadece admin girişi yapılmışsa tabloyu render et
        if (window.isAdminLoggedIn) {
            window.renderAdminInquiryTable(); 
        }
    }, (error) => {
        console.error("Teklif İstekleri (Inquiries) Hata:", error);
        window.showMessage(`Teklif istekleri yüklenirken hata oluştu: ${error.code}`, 'bg-red-600');
    });
}
        
        function listenToContactInfo() {
    // ✅ HIZLI BAŞLANGIÇ: localStorage'dan önbelleği yükle
    const cachedContact = localStorage.getItem('bzk_contact_cache');
    if (cachedContact && (!window.contactInfo || !window.contactInfo.phone)) {
        try {
            window.contactInfo = JSON.parse(cachedContact);
            window.renderContactInfo();
            console.log("⚡ İletişim bilgileri cache'den yüklendi (ANINDA render)");
        } catch (e) {
            console.warn("İletişim cache parse hatası:", e);
        }
    }
    
    const contactRef = doc(db, CONTACT_INFO_PATH, 'main');

    onSnapshot(contactRef, (docSnap) => {
        console.log("Firestore'dan veri alındı | exists:", docSnap.exists(), "| raw data:", docSnap.data(), "| timestamp:", new Date().toISOString());
        
        if (docSnap.exists()) {
            const data = docSnap.data();
            window.contactInfo = {
                address: data.address?.stringValue || data.address || "Adres bilgisi eksik",
                phone: data.phone?.stringValue || data.phone || "Telefon bilgisi eksik",
                email: data.email?.stringValue || data.email || "E-posta bilgisi eksik"
            };
            
            // ✅ localStorage'a kaydet
            try {
                localStorage.setItem('bzk_contact_cache', JSON.stringify(window.contactInfo));
                console.log("💾 İletişim bilgileri cache'e kaydedildi");
            } catch (e) {
                console.warn("Cache kaydetme hatası:", e);
            }
            
            console.log("window.contactInfo güncellendi:", window.contactInfo, "| timestamp:", new Date().toISOString());
            
            // ✅ EKLE: DOM hazır olana kadar bekle
            if (document.readyState === 'loading') {
                document.addEventListener('DOMContentLoaded', () => {
                    window.renderContactInfo();
                });
            } else {
                window.renderContactInfo();
            }
            
        } else {
            console.warn("Firestore'da contact_info/main belgesi bulunamadı. | timestamp:", new Date().toISOString());
            
            // ✅ EKLE: Default değerler
            window.contactInfo = {
                address: "Örnek Mah. Elit Cad. No: 42/A Konak, İzmir / Türkiye",
                phone: "+90 232 XXX XX XX",
                email: "info@bozkurtinsaat.com.tr"
            };
            
            // ✅ EKLE: Default değerlerle de render et
            if (document.readyState === 'loading') {
                document.addEventListener('DOMContentLoaded', () => {
                    window.renderContactInfo();
                });
            } else {
                window.renderContactInfo();
            }
        }

        if (window.isAdminLoggedIn) {
            console.log("Admin paneli için iletişim formu dolduruluyor. | timestamp:", new Date().toISOString());
            window.populateContactForm();
        }
    }, (error) => {
        console.error("Contact Info Firestore Hata:", error, "| timestamp:", new Date().toISOString());
        window.showMessage(`İletişim bilgileri yüklenirken hata: ${error.message}`, 'bg-red-600');
        
        // ✅ EKLE: Hata durumunda default değerler
        window.contactInfo = {
            address: "Örnek Mah. Elit Cad. No: 42/A Konak, İzmir / Türkiye",
            phone: "+90 232 XXX XX XX",
            email: "info@bozkurtinsaat.com.tr"
        };
        window.renderContactInfo();
    });
}

// ✨ YENİ: HAKKIMIZDA LİSTENER
function listenToAboutUs() {
    // ✅ HIZLI BAŞLANGIÇ: localStorage'dan önbelleği yükle
    const cachedAboutUs = localStorage.getItem('bzk_aboutus_cache');
    if (cachedAboutUs && (!window.aboutUs || !window.aboutUs.content)) {
        try {
            window.aboutUs = JSON.parse(cachedAboutUs);
            window.renderAboutUs();
            console.log("⚡ Hakkımızda cache'den yüklendi (ANINDA render)");
        } catch (e) {
            console.warn("Hakkımızda cache parse hatası:", e);
        }
    }
    
    const aboutRef = doc(db, 'settings', 'aboutUs');
    
    onSnapshot(aboutRef, (docSnap) => {
        console.log("Hakkımızda verisi alındı | exists:", docSnap.exists());
        
        if (docSnap.exists()) {
            const data = docSnap.data();
            window.aboutUs = {
                title: data.title || 'Hakkımızda',
                content: data.content || ''
            };
            
            // ✅ localStorage'a kaydet
            try {
                localStorage.setItem('bzk_aboutus_cache', JSON.stringify(window.aboutUs));
                console.log("💾 Hakkımızda cache'e kaydedildi");
            } catch (e) {
                console.warn("Cache kaydetme hatası:", e);
            }
            
            console.log("Hakkımızda verisi yüklendi:", window.aboutUs);
        } else {
            console.log("Hakkımızda belgesi yok, default değerler kullanılıyor.");
            window.aboutUs = {
                title: 'Bozkurt İnşaat Hakkında',
                content: 'İçerik henüz eklenmedi.'
            };
        }
        
        // Public sitede göster
        window.renderAboutUs();
        
        // Admin panelinde formu doldur
        if (window.isAdminLoggedIn) {
            window.populateAboutForm();
        }
    }, (error) => {
        console.error("Hakkımızda Firestore Hata:", error);
        window.showMessage(`Hakkımızda bilgileri yüklenirken hata: ${error.message}`, 'bg-red-600');
        
        // Hata durumunda default değerler
        window.aboutUs = {
            title: 'Bozkurt İnşaat Hakkında',
            content: 'İçerik henüz eklenmedi.'
        };
        window.renderAboutUs();
    });
}

// Proje Silme Fonksiyonu
window.deleteProject = async (projectId) => {
    if (!confirm("Bu projeyi kalıcı olarak silmek istediğinizden emin misiniz? Bu işlem geri alınamaz!")) {
        return;
    }
    
    if (!db || !auth.currentUser) {
        window.showMessage("Veritabanı bağlantısı yok veya yetkiniz eksik.", 'bg-red-600');
        return;
    }

    try {
        // Firestore'dan belgeyi sil
        await deleteDoc(doc(db, PROJECT_COLLECTION_PATH, projectId));
        
        window.showMessage("Proje başarıyla silindi!", 'bg-green-600');
        
        // Tablo otomatik güncellenecek (onSnapshot sayesinde)
        // Ama emin olmak için manuel de tetikleyebiliriz:
        if (window.isAdminLoggedIn) {
            window.renderAdminProjectTable();
        }
    } catch (error) {
        console.error("Proje silme hatası:", error);
        window.showMessage(`Silme hatası: ${error.message}`, 'bg-red-600', 5000);
    }
};

        // --- ADMIN CRUD İŞLEMLERİ ---

        // Proje Ekle/Güncelle
        window.saveProject = async (data) => {
            if (!db || !auth.currentUser) {
                window.showMessage("Veritabanı bağlantısı yok veya yetkiniz eksik.", 'bg-red-600');
                return;
            }
            
            const projectId = data.id;
            delete data.id; 

            try {
                // Özellikler dizisini (features) virgülle ayrılmış string'den array'e çevir
                if (data.featuresString) {
                    data.features = data.featuresString.split(',').map(f => f.trim()).filter(f => f.length > 0);
                } else {
                    data.features = [];
                }
                delete data.featuresString; 
                
                // GÜNCELLEME: Global Base64/URL dizisini kaydet
                data.images = window.currentProjectImages; 
                
                // Firestore'da 1MB limitini kontrol etmeye yardımcı olmak için bir uyarı ekle
                if (JSON.stringify(data).length > 800000) { 
                    window.showMessage("⚠️ Proje boyutu 1MB limitine yaklaşıyor. Daha az görsel veya daha kısa metin kullanın.", 'bg-yellow-600', 8000);
                }

                if (projectId) {
                    // UPDATE: Mevcut belgeyi güncelle
                    await setDoc(doc(db, PROJECT_COLLECTION_PATH, projectId), data, { merge: true });
                    window.showMessage("Proje başarıyla güncellendi!", 'bg-green-600');
                } else {
                    // CREATE: Yeni belge ekle
                    await addDoc(projectsRef, data);
                    window.showMessage("Yeni proje başarıyla eklendi!", 'bg-green-600');
                }
                window.hideProjectModal();
            } catch (error) {
                console.error("Proje kaydetme hatası:", error);
                window.showMessage(`Kaydetme hatası: ${error.message}`, 'bg-red-600');
            }
        };

        // YENI: Teklif İsteği Silme Fonksiyonu
window.deleteInquiry = async (inquiryId) => {
    if (!confirm("Bu teklif isteğini kalıcı olarak silmek istediğinizden emin misiniz?")) return;
    if (!db || !auth.currentUser) {
        window.showMessage("Yetkiniz yok.", 'bg-red-600');
        return;
    }

    try {
        await deleteDoc(doc(db, INQUIRY_COLLECTION_PATH, inquiryId));
        window.showMessage("Teklif isteği başarıyla silindi.", 'bg-green-600');
    } catch (error) {
        console.error("Teklif silme hatası:", error);
        window.showMessage(`Silme hatası: ${error.message}`, 'bg-red-600');
    }
};

        // ✅ Teklif Durum Güncelleme
        window.updateInquiryStatus = async (inquiryId, newStatus) => {
            if (!db || !auth.currentUser) {
                window.showMessage("Yetkiniz yok.", 'bg-red-600');
                return;
            }
            
            try {
                await setDoc(doc(db, INQUIRY_COLLECTION_PATH, inquiryId), {
                    status: newStatus
                }, { merge: true });
                
                window.showMessage(`Durum güncellendi: ${newStatus}`, 'bg-green-600');
            } catch (error) {
                console.error("Durum güncelleme hatası:", error);
                window.showMessage(`Güncelleme hatası: ${error.message}`, 'bg-red-600');
            }
        };

        
        // YENİ: Public iletişim formundan gelen veriyi kaydetme
        window.submitInquiry = async function(form) {
            const name = form.querySelector('#contact-name').value.trim();
            const email = form.querySelector('#contact-email').value.trim();
            const message = form.querySelector('#contact-message').value.trim();

            if (!name || !email || !message) {
                window.showMessage("Lütfen tüm alanları doldurun.", 'bg-red-600');
                return;
            }
            
            if (!db) {
                window.showMessage("Veritabanı bağlantısı henüz hazır değil. Lütfen bekleyin.", 'bg-red-600');
                return;
            }

            try {
                await addDoc(collection(db, INQUIRY_COLLECTION_PATH), {
                    name: name,
                    email: email,
                    message: message,
                    timestamp: new Date().toISOString(),
                    status: 'Yeni'
                });
                
                window.showMessage("Teklif isteğiniz başarıyla alındı! En kısa sürede size dönüş yapacağız.", 'bg-green-600');
                form.reset();
            } catch (error) {
                console.error("Teklif gönderme hatası:", error);
                window.showMessage(`Hata: İsteğiniz gönderilemedi. ${error.message}`, 'bg-red-600', 8000);
            }
        }
        // İletişim Bilgilerini Kaydetme (ADMIN)
        window.saveContactInfo = async function() {
    const address = document.getElementById('admin-contact-address').value.trim();
    const phone = document.getElementById('admin-contact-phone').value.trim();
    const email = document.getElementById('admin-contact-email').value.trim();

    if (!address || !phone || !email) {
        window.showMessage("Tüm alanlar doldurulmalıdır.", 'bg-red-600');
        return;
    }

    if (!db || !auth.currentUser) {
        window.showMessage("Yetkiniz yok.", 'bg-red-600');
        return;
    }

    try {
        await setDoc(doc(db, CONTACT_INFO_PATH, 'main'), {
            address: address,
            phone: phone,
            email: email
        });
        
        // ✅ EKLE: Global değişkeni hemen güncelle
        window.contactInfo = { address, phone, email };
        
        // ✅ EKLE: Ana sayfadaki UI'yi güncelle
        window.renderContactInfo();
        
        window.showMessage("İletişim bilgileri güncellendi!", 'bg-green-600');
    } catch (error) {
        console.error("İletişim kaydetme hatası:", error);
        window.showMessage(`Hata: ${error.message}`, 'bg-red-600');
    }
};

        // ✨ YENİ: HAKKIMIZDA KAYDETME (Firestore)
        window.saveAboutUs = async function() {
            const title = document.getElementById('about-title').value.trim();
            const content = document.getElementById('about-content').value.trim();
            
            if (!title || !content) {
                window.showMessage('Başlık ve içerik alanları zorunludur!', 'bg-red-600');
                return;
            }
            
            if (!db || !auth.currentUser) {
                window.showMessage('Veritabanı bağlantısı yok veya yetkiniz eksik.', 'bg-red-600');
                return;
            }
            
            try {
                const aboutRef = doc(db, 'settings', 'aboutUs');
                await setDoc(aboutRef, {
                    title: title,
                    content: content,
                    updatedAt: new Date().toISOString(),
                    updatedBy: auth.currentUser.email
                });
                
                window.aboutUs = { title, content };
                window.renderAboutUs();
                
                window.showMessage('✅ Hakkımızda bilgileri güncellendi!', 'bg-green-600');
            } catch (error) {
                console.error('Hakkımızda kaydetme hatası:', error);
                window.showMessage(`❌ Hata: ${error.message}`, 'bg-red-600');
            }
        };
        
        // ✨ YENİ: HAKKIMIZDA RENDER (Public Site)
        window.renderAboutUs = function() {
            const titleEl = document.getElementById('about-title-display');
            const contentEl = document.getElementById('about-content-display');
            
            if (titleEl) titleEl.textContent = window.aboutUs.title || 'Hakkımızda';
            if (contentEl) contentEl.textContent = window.aboutUs.content || 'İçerik bekleniyor...';
        };
        
        // ✨ YENİ: HAKKIMIZDA FORM DOLDUR (Admin Panel)
        window.populateAboutForm = function() {
            const titleInput = document.getElementById('about-title');
            const contentInput = document.getElementById('about-content');
            
            if (titleInput) titleInput.value = window.aboutUs.title || '';
            if (contentInput) contentInput.value = window.aboutUs.content || '';
        };
        
        // setupDragScroll fonksiyonu kaldırıldı - mobilde dikey grid kullanılıyor
        
        // Başlat
        // ✅ Firebase'i sayfa yüklenir yüklenmez başlat (daha hızlı)
        window.addEventListener('DOMContentLoaded', window.initFirebase);

        // Public signOut fonksiyonu
        window.adminLogout = async () => {
            window.isAdminLoggedIn = false;
            window.showView('main');
            window.showMessage("Yönetici oturumu kapatıldı.", 'bg-yellow-600');
        };

    </script>
</head>
<body class="elite-bg text-gray-100">
    
    <!-- ✨ MODERN LOADING SCREEN -->
    <!-- ✅ Loading screen kaldırıldı - Projeler bölümünde gösterilecek -->
    
    <!-- 1. ANA SİTE GÖRÜNÜMÜ -->
    <div id="main-view" class="visible-view">
        <!-- Hero Arkaplanı (Sabitlenmiş - Pinning Effect) -->
        <div class="hero-pin-bg">
            <div class="hero-vignette"></div>
        </div>
    
        <!-- Navigasyon Çubuğu (Sabit ve Responsive) -->
        <header class="modern-header sticky top-0 z-50">
            <nav class="header-container">
                <!-- Logo / Marka -->
                <a href="#" class="header-logo group">
                    <div class="logo-icon-wrapper">
                        <i data-lucide="building-2" class="logo-icon"></i>
                    </div>
                    <span class="logo-text">BOZKURT İNŞAAT</span>
                </a>
                
                <!-- Desktop Navigasyon -->
                <div class="desktop-nav">
                    <a href="#projelerimiz" class="nav-link">
                        <i data-lucide="home" class="nav-icon"></i>
                        <span>Projelerimiz</span>
                    </a>
                    <a href="#hakkimizda" class="nav-link">
                        <i data-lucide="info" class="nav-icon"></i>
                        <span>Hakkımızda</span>
                    </a>
                    <a href="#iletisim" class="nav-link">
                        <i data-lucide="mail" class="nav-icon"></i>
                        <span>İletişim</span>
                    </a>
                </div>
                
                <!-- Mobil Hamburger Menü -->
                <button id="menu-button" class="mobile-menu-button" aria-expanded="false" aria-controls="mobile-menu" aria-label="Menüyü Aç/Kapat">
                    <i data-lucide="menu" class="menu-icon"></i>
                </button>
            </nav>
            
            <!-- Mobil Menü -->
            <div id="mobile-menu" class="mobile-menu hidden">
                <a href="#projelerimiz" class="mobile-nav-link menu-item-link">
                    <i data-lucide="home" class="mobile-nav-icon"></i>
                    <span>Projelerimiz</span>
                </a>
                <a href="#hakkimizda" class="mobile-nav-link menu-item-link">
                    <i data-lucide="info" class="mobile-nav-icon"></i>
                    <span>Hakkımızda</span>
                </a>
                <a href="#iletisim" class="mobile-nav-link menu-item-link">
                    <i data-lucide="mail" class="mobile-nav-icon"></i>
                    <span>İletişim</span>
                </a>
            </div>
        </header>
        <!-- Hero Section -->
    <section class="hero-section min-h-[calc(100vh-3rem)] md:min-h-screen flex flex-col justify-center items-start md:items-center content-overlay">
    <div class="hero-container w-full">
        <div class="hero-content" data-scroll-animate>
            <div class="section-separator mb-4"></div>
            <p class="hero-subtitle text-base sm:text-xl font-semibold text-white mb-3 tracking-widest uppercase">BOZKURT İNŞAAT - Elit Yaşam</p>
            <h1 class="hero-title text-3xl sm:text-5xl lg:text-6xl xl:text-7xl font-extrabold text-white mb-6 leading-tight animate-fade-in-up">
                Lüksün ve Kalitenin <span class="elite-text">Yüksek Mimarisi</span>
            </h1>
            <p class="hero-description text-base sm:text-lg md:text-xl text-gray-300 mb-8 leading-relaxed">
                İzmir'in en prestijli konut ve ticari projelerini, yenilikçi tasarım ve sarsılmaz kalite garantisiyle hayata geçiriyoruz.
            </p>
            <a href="#projelerimiz" class="hero-cta inline-block px-8 sm:px-12 py-3 sm:py-4 bg-yellow-400 text-slate-900 font-extrabold text-base sm:text-lg rounded-full shadow-2xl transition duration-300 transform hover:scale-105 tracking-wide">
                Projelerimizi Keşfet →
            </a>
        </div>
    </div>
    
</section>
    
        <!-- Ana İçerik ve Projeler -->
        <main class="content-overlay elite-bg shadow-2xl">
    
            <!-- Projelerimiz (Our Projects) Section -->
            <section id="projelerimiz" class="py-16 md:py-24 container mx-auto lg:px-8">
                <div class="text-center mb-12 px-4 sm:px-6">
                    <div data-scroll-animate>
                        <h3 class="text-4xl font-extrabold mb-4 text-white">Öne Çıkan Projelerimiz</h3>
                        <div class="section-separator mx-auto"></div>
                        <p class="text-lg text-gray-300 mt-6">İzmir'in geleceğine değer katan, modern ve elit yaşam alanlarımız.</p>
                    </div>
                </div>
    
                <!-- Tamamlanan Projeler Listesi -->
<div class="px-2 sm:px-6 lg:px-8">
    <div class="text-center mb-8 mt-12">
        <h4 data-scroll-animate data-scroll-delay="100" class="text-3xl font-extrabold text-white mb-2 elite-text">Tamamlanan Projeler</h4>
        <div data-scroll-animate data-scroll-delay="200" class="section-separator mx-auto w-16"></div>
    </div>
    
<div id="completed-projects-container" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-10 max-w-7xl mx-auto">
    <div class="col-span-full flex flex-col items-center justify-center py-12">
        <div class="relative w-16 h-16 mb-4">
            <div class="absolute inset-0 border-4 border-slate-700 rounded-full"></div>
            <div class="absolute inset-0 border-4 border-yellow-500 border-t-transparent rounded-full animate-spin"></div>
        </div>
        <p class="text-gray-400 text-lg animate-pulse">Projeler yükleniyor...</p>
    </div>
</div>
<!-- HORIZONTAL SCROLL CONTAINER END -->
</div>

<div id="no-completed-projects" class="text-center text-gray-500 mt-8 hidden p-4 bg-slate-800 rounded-lg max-w-md mx-auto">
    Henüz tamamlanmış projemiz bulunmamaktadır.
</div>  

                <!-- Devam Eden Projeler Listesi -->
                <div class="px-2 sm:px-6 lg:px-8">
                    <div class="text-center mt-16 mb-8">
                        <h4 data-scroll-animate data-scroll-delay="100" class="text-3xl font-extrabold text-white mb-2 elite-text">Devam Eden Projeler</h4>
                        <div data-scroll-animate data-scroll-delay="200" class="section-separator mx-auto w-16"></div>
                    </div>
                    <div id="ongoing-projects-container" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-10 max-w-7xl mx-auto">
                        <div class="col-span-full flex flex-col items-center justify-center py-12">
                            <div class="relative w-16 h-16 mb-4">
                                <div class="absolute inset-0 border-4 border-slate-700 rounded-full"></div>
                                <div class="absolute inset-0 border-4 border-yellow-500 border-t-transparent rounded-full animate-spin"></div>
                            </div>
                            <p class="text-gray-400 text-lg animate-pulse">Projeler yükleniyor...</p>
                        </div>
                    </div>
                    <div id="no-ongoing-projects" class="text-center text-gray-500 mt-8 hidden p-4 bg-slate-800 rounded-lg max-w-md mx-auto">
                        Şu anda devam eden bir projemiz bulunmamaktadır.
                    </div>
                </div>
            </section>
    
            <!-- Hakkımızda (About Us) Section - ✨ DİNAMİK -->
            <section id="hakkimizda" class="py-16 md:py-24 bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 container mx-auto px-4 sm:px-6 lg:px-8">
                <div class="max-w-6xl mx-auto">
                    <div data-scroll-animate class="text-center mb-12">
                        <h3 id="about-title-display" class="text-4xl md:text-5xl font-extrabold mb-4 text-white elite-text">
                            Neden Bozkurt İnşaat?
                        </h3>
                        <div class="section-separator mx-auto"></div>
                    </div>
                    
                    <!-- Dinamik İçerik -->
                    <div class="bg-slate-800/50 p-8 md:p-12 rounded-2xl border border-slate-700 shadow-2xl">
                        <p id="about-content-display" class="text-lg md:text-xl text-gray-300 leading-relaxed whitespace-pre-wrap">
                            20 yılı aşkın tecrübeyle, sadece binalar değil, gelecek nesillere miras kalacak güvenli ve estetik yaşam merkezleri inşa ediyoruz.
                        </p>
                    </div>
                    
                    <!-- Özellik Kartları -->
                    <div class="mt-12 md:mt-16 feature-card-container">
                        <div data-scroll-animate data-scroll-delay="0" class="feature-card">
                            <span class="feature-icon elite-text">📏</span>
                            <p class="feature-title">Modern Tasarım</p>
                            <p class="feature-description">İzmir'in ruhuna uygun, çağdaş ve fonksiyonel mimari çözümler.</p>
                        </div>
                        <div data-scroll-animate data-scroll-delay="200" class="feature-card">
                            <span class="feature-icon elite-text">✅</span>
                            <p class="feature-title">Maksimum Güven</p>
                            <p class="feature-description">Deprem yönetmeliklerine tam uyum ve birinci sınıf yapı malzemeleri.</p>
                        </div>
                        <div data-scroll-animate data-scroll-delay="400" class="feature-card">
                            <span class="feature-icon elite-text">🤝</span>
                            <p class="feature-title">Şeffaf Süreç</p>
                            <p class="feature-description">Söz verdiğimiz zamanda ve kalitede teslimat garantisi.</p>
                        </div>
                    </div>
                </div>
            </section>
    
            <!-- İletişim (Contact) Section -->
            <section id="iletisim" class="py-16 md:py-24 elite-bg container mx-auto px-4 sm:px-6 lg:px-8">
                <div class="max-w-4xl mx-auto">
                    <div data-scroll-animate class="text-center mb-12">
                        <h3 class="text-4xl font-extrabold mb-4 text-white">Bize Ulaşın</h3>
                        <div class="section-separator mx-auto"></div>
                        <p class="text-lg text-gray-300 mt-6">Hayalinizdeki projeyi konuşmak için her zaman hazırız.</p>
                    </div>
    
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-12">
                        <!-- İletişim Bilgileri (Animasyonlu) -->
                        <div data-scroll-animate class="space-y-8 p-6 bg-slate-900 rounded-xl shadow-2xl">
    <div class="flex items-start">
        <span class="elite-text text-2xl mr-4 mt-0.5">📍</span>
        <div>
            <p class="font-bold text-lg text-white">Merkez Adresimiz</p>
            <p id="contact-address-display" class="text-gray-400"></p>
        </div>
    </div>
    <div class="flex items-start">
        <span class="elite-text text-2xl mr-4 mt-0.5">📞</span>
        <div>
            <p class="font-bold text-lg text-white">Telefon ve E-posta</p>
            <p class="text-gray-400">
                <a id="contact-phone-link" href="tel:" class="hover:underline hover:text-yellow-400 transition">
                    <span id="contact-phone-display"></span>
                </a>
            </p>
            <p class="text-gray-400">
                <a id="contact-email-link" href="/cdn-cgi/l/email-protection#da" class="hover:underline hover:text-yellow-400 transition">
                    <span id="contact-email-display"></span>
                </a>
            </p>
        </div>
    </div>
</div>
    
                        <!-- İletişim Formu (GÜNCELLENDİ) -->
                        <div data-scroll-animate data-scroll-delay="200" class="p-8 bg-slate-800 rounded-xl shadow-2xl">
                            <h4 class="text-2xl font-bold text-white elite-text">Proje Teklifi Alın</h4>
                            <!-- onsubmit fonksiyonu değiştirildi ve ID'ler eklendi -->
                            <form onsubmit="event.preventDefault(); window.submitInquiry(this)"> 
                                <div class="mb-4">
                                    <input type="text" id="contact-name" placeholder="Adınız Soyadınız" required class="w-full p-3 rounded-lg bg-slate-700 text-white border border-slate-600 focus:elite-border focus:ring focus:ring-yellow-500 focus:ring-opacity-50 transition duration-200">
                                </div>
                                <div class="mb-4">
                                    <input type="email" id="contact-email" placeholder="E-posta Adresiniz" required class="w-full p-3 rounded-lg bg-slate-700 text-white border border-slate-600 focus:elite-border focus:ring focus:ring-yellow-500 focus:ring-opacity-50 transition duration-200">
                                </div>
                                <div class="mb-6">
                                    <textarea id="contact-message" placeholder="Mesajınız" rows="4" required class="w-full p-3 rounded-lg bg-slate-700 text-white border border-slate-600 focus:elite-border focus:ring focus:ring-yellow-500 focus:ring-opacity-50 transition duration-200"></textarea>
                                </div>
                                <button type="submit" class="w-full px-6 py-3 bg-elite-text bg-yellow-400 text-slate-900 font-bold rounded-full shadow-lg transition duration-300 transform hover:scale-[1.05]">
                                    Teklif İsteği Gönder
                                </button>
                            </form>
                        </div>
                    </div>
                </div>
            </section>
        </main>
    
        <!-- Footer -->
        <footer class="elite-bg py-8 border-t border-slate-700 content-overlay">
            <div class="container mx-auto px-4 text-center">
                <p class="text-sm text-gray-500 mb-2">
                    © 2024 Bozkurt İnşaat. Tüm Hakları Saklıdır.
                </p>
                <!-- DEBUG/FALLBACK ADMIN BUTONU -->
                <button id="debug-admin-btn" onclick="window.showLoginModal()" class="hidden px-4 py-1 text-xs bg-red-800 text-white rounded hover:bg-red-700 transition">
                    Admin Giriş (Yedek)
                </button>
            </div>
        </footer>
    </div>
    
    <!-- 2. ADMIN PANELİ GÖRÜNÜMÜ - SIDEBAR LAYOUT -->
    <div id="admin-view" class="admin-view hidden-view">
        <div class="flex h-screen">
            
            <!-- ═══════════════════════════════════════════════════════════════ -->
            <!-- 📱 SIDEBAR -->
            <!-- ═══════════════════════════════════════════════════════════════ -->
            <aside id="admin-sidebar" class="admin-sidebar">
                <!-- Logo & Firma Adı -->
                <div class="p-6 border-b border-slate-700/50">
                    <div class="flex items-center gap-3">
                        <div class="w-10 h-10 bg-gradient-to-br from-brand to-brand-dark rounded-xl flex items-center justify-center shadow-lg flex-shrink-0">
                            <i data-lucide="building-2" class="w-5 h-5 text-slate-900"></i>
                        </div>
                        <div class="sidebar-text">
                            <h1 class="text-lg font-bold text-white" id="admin-company-name">BZK Yapı</h1>
                            <p class="text-xs text-gray-400">Yönetici Paneli</p>
                        </div>
                    </div>
                </div>
                
                <!-- Menü -->
                <nav class="flex-1 p-4 space-y-1 overflow-y-auto">
                    <button onclick="window.showAdminSection('dashboard')" class="admin-menu-item active" data-section="dashboard">
                        <i data-lucide="layout-dashboard" class="w-5 h-5"></i>
                        <span class="sidebar-text">Gösterge Paneli</span>
                    </button>
                    <button onclick="window.showAdminSection('projects')" class="admin-menu-item" data-section="projects">
                        <i data-lucide="building-2" class="w-5 h-5"></i>
                        <span class="sidebar-text">Projeler</span>
                        <span class="admin-badge sidebar-text" id="badge-projects">0</span>
                    </button>
                    <button onclick="window.showAdminSection('inquiries')" class="admin-menu-item" data-section="inquiries">
                        <i data-lucide="mail" class="w-5 h-5"></i>
                        <span class="sidebar-text">Teklif İstekleri</span>
                        <span class="admin-badge-alert sidebar-text" id="badge-inquiries">0</span>
                    </button>
                    
                    <div class="pt-4 mt-4 border-t border-slate-700/50">
                        <p class="px-3 text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2 sidebar-text">Ayarlar</p>
                    </div>
                    
                    <button onclick="window.showAdminSection('contact')" class="admin-menu-item" data-section="contact">
                        <i data-lucide="phone" class="w-5 h-5"></i>
                        <span class="sidebar-text">İletişim Bilgileri</span>
                    </button>
                    <button onclick="window.showAdminSection('about')" class="admin-menu-item" data-section="about">
                        <i data-lucide="info" class="w-5 h-5"></i>
                        <span class="sidebar-text">Hakkımızda</span>
                    </button>
                    <button onclick="window.showAdminSection('settings')" class="admin-menu-item" data-section="settings">
                        <i data-lucide="settings" class="w-5 h-5"></i>
                        <span class="sidebar-text">Site Ayarları</span>
                    </button>
                </nav>
                
                <!-- Alt Kısım - Kullanıcı & Çıkış -->
                <div class="p-4 border-t border-slate-700/50">
                    <button onclick="window.adminLogout()" class="admin-menu-item text-red-400 hover:bg-red-500/10 hover:text-red-300">
                        <i data-lucide="log-out" class="w-5 h-5"></i>
                        <span class="sidebar-text">Çıkış Yap</span>
                    </button>
                    <button onclick="window.open('https://www.bzkyapi.com', '_blank')" class="admin-menu-item mt-2 text-gray-400 hover:bg-slate-700/50">
                        <i data-lucide="external-link" class="w-5 h-5"></i>
                        <span class="sidebar-text">Siteyi Görüntüle</span>
                    </button>
                </div>
            </aside>
            
            <!-- ═══════════════════════════════════════════════════════════════ -->
            <!-- 📄 ANA İÇERİK ALANI -->
            <!-- ═══════════════════════════════════════════════════════════════ -->
            <main class="admin-main-content">
                <!-- Top Bar -->
                <header class="admin-topbar">
                    <div class="flex items-center gap-4">
                        <button onclick="window.toggleAdminSidebar()" class="lg:hidden p-2 rounded-lg hover:bg-slate-700/50 text-gray-400">
                            <i data-lucide="menu" class="w-6 h-6"></i>
                        </button>
                        <div>
                            <h2 class="text-xl font-bold text-white" id="admin-page-title">Gösterge Paneli</h2>
                            <p class="text-sm text-gray-400" id="admin-page-subtitle">Genel bakış ve istatistikler</p>
                        </div>
                    </div>
                    <div class="flex items-center gap-3">
                        <span class="text-sm text-gray-400 hidden sm:block" id="admin-current-date"></span>
                        <div class="w-8 h-8 bg-gradient-to-br from-brand to-brand-dark rounded-full flex items-center justify-center">
                            <i data-lucide="user" class="w-4 h-4 text-slate-900"></i>
                        </div>
                    </div>
                </header>
                
                <!-- İçerik Bölümleri -->
                <div class="p-6 overflow-y-auto" style="height: calc(100vh - 73px);">
                    
                    <!-- ═══════════════════════════════════════════════════════ -->
                    <!-- 📊 DASHBOARD BÖLÜMÜ -->
                    <!-- ═══════════════════════════════════════════════════════ -->
                    <section id="section-dashboard" class="admin-section active">
                        <!-- Stats Kartları -->
                        <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-8">
                            <div class="admin-stat-card">
                                <div class="flex items-center justify-between">
                                    <div>
                                        <p class="text-sm text-gray-400">Toplam Proje</p>
                                        <p class="admin-stat-number" id="stat-total-projects">0</p>
                                    </div>
                                    <div class="w-12 h-12 bg-brand/10 rounded-xl flex items-center justify-center">
                                        <i data-lucide="building-2" class="w-6 h-6 text-brand"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="admin-stat-card">
                                <div class="flex items-center justify-between">
                                    <div>
                                        <p class="text-sm text-gray-400">Devam Eden</p>
                                        <p class="admin-stat-number text-yellow-500" id="stat-ongoing-projects">0</p>
                                    </div>
                                    <div class="w-12 h-12 bg-yellow-500/10 rounded-xl flex items-center justify-center">
                                        <i data-lucide="clock" class="w-6 h-6 text-yellow-500"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="admin-stat-card">
                                <div class="flex items-center justify-between">
                                    <div>
                                        <p class="text-sm text-gray-400">Tamamlanan</p>
                                        <p class="admin-stat-number text-green-500" id="stat-completed-projects">0</p>
                                    </div>
                                    <div class="w-12 h-12 bg-green-500/10 rounded-xl flex items-center justify-center">
                                        <i data-lucide="check-circle" class="w-6 h-6 text-green-500"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="admin-stat-card">
                                <div class="flex items-center justify-between">
                                    <div>
                                        <p class="text-sm text-gray-400">Bekleyen Talep</p>
                                        <p class="admin-stat-number text-red-500" id="stat-pending-inquiries">0</p>
                                    </div>
                                    <div class="w-12 h-12 bg-red-500/10 rounded-xl flex items-center justify-center">
                                        <i data-lucide="mail" class="w-6 h-6 text-red-500"></i>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <!-- Hızlı Erişim -->
                        <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
                            <div class="admin-card p-6">
                                <h3 class="text-lg font-semibold text-white mb-4 flex items-center gap-2">
                                    <i data-lucide="zap" class="w-5 h-5 text-brand"></i>
                                    Hızlı İşlemler
                                </h3>
                                <div class="grid grid-cols-2 gap-3">
                                    <button onclick="window.openProjectModal()" class="admin-quick-action">
                                        <i data-lucide="plus" class="w-5 h-5"></i>
                                        <span>Yeni Proje</span>
                                    </button>
                                    <button onclick="window.showAdminSection('inquiries')" class="admin-quick-action">
                                        <i data-lucide="mail" class="w-5 h-5"></i>
                                        <span>Talepleri Gör</span>
                                    </button>
                                    <button onclick="window.showAdminSection('contact')" class="admin-quick-action">
                                        <i data-lucide="phone" class="w-5 h-5"></i>
                                        <span>İletişim Düzenle</span>
                                    </button>
                                    <button onclick="window.showView('main')" class="admin-quick-action">
                                        <i data-lucide="external-link" class="w-5 h-5"></i>
                                        <span>Siteyi Önizle</span>
                                    </button>
                                </div>
                            </div>
                            
                            <div class="admin-card p-6">
                                <h3 class="text-lg font-semibold text-white mb-4 flex items-center gap-2">
                                    <i data-lucide="activity" class="w-5 h-5 text-brand"></i>
                                    Son Aktiviteler
                                </h3>
                                <div id="recent-activities" class="space-y-3">
                                    <p class="text-gray-500 text-sm">Henüz aktivite yok.</p>
                                </div>
                            </div>
                        </div>
                    </section>
                    
                    <!-- ═══════════════════════════════════════════════════════ -->
                    <!-- 🏗️ PROJELER BÖLÜMÜ -->
                    <!-- ═══════════════════════════════════════════════════════ -->
                    <section id="section-projects" class="admin-section">
                        <div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6">
                            <div>
                                <h3 class="text-lg font-semibold text-white">Tüm Projeler</h3>
                                <p class="text-sm text-gray-400">Projeleri yönetin, düzenleyin veya silin</p>
                            </div>
                            <button onclick="window.openProjectModal()" class="admin-btn-primary flex items-center gap-2">
                                <i data-lucide="plus" class="w-5 h-5"></i> Yeni Proje Ekle
                            </button>
                        </div>
                        
                        <div class="admin-card overflow-hidden">
                            <div class="overflow-x-auto">
                                <table class="admin-table w-full">
                                    <thead>
                                        <tr>
                                            <th class="text-left">Başlık</th>
                                            <th class="text-left">Durum</th>
                                            <th class="text-left">Yıl</th>
                                            <th class="text-center">Sıra</th>
                                            <th class="text-right">Eylemler</th>
                                        </tr>
                                    </thead>
                                    <tbody id="admin-project-table-body">
                                        <tr><td colspan="5" class="text-center py-8 text-gray-500">Projeler yükleniyor...</td></tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <p id="admin-no-projects-message" class="text-center text-gray-500 mt-8 hidden">Henüz bir proje eklenmemiş.</p>
                    </section>
                    
                    <!-- ═══════════════════════════════════════════════════════ -->
                    <!-- 📧 TEKLİF İSTEKLERİ BÖLÜMÜ -->
                    <!-- ═══════════════════════════════════════════════════════ -->
                    <section id="section-inquiries" class="admin-section">
                        <div class="mb-6">
                            <h3 class="text-lg font-semibold text-white">Gelen Teklif İstekleri</h3>
                            <p class="text-sm text-gray-400">Müşteri taleplerini görüntüleyin ve yönetin</p>
                        </div>
                        
                        <div class="admin-card overflow-hidden">
                            <div class="overflow-x-auto">
                                <table class="admin-table w-full">
                                    <thead>
                                        <tr>
                                            <th class="text-left">Ad Soyad</th>
                                            <th class="text-left">E-posta</th>
                                            <th class="text-left">Mesaj</th>
                                            <th class="text-left">Tarih</th>
                                            <th class="text-center">Durum</th>
                                            <th class="text-right">Eylemler</th>
                                        </tr>
                                    </thead>
                                    <tbody id="admin-inquiry-table-body">
                                        <tr><td colspan="6" class="text-center py-8 text-gray-500">İstekler yükleniyor...</td></tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <p id="admin-no-inquiries-message" class="text-center text-gray-500 mt-8 hidden">Henüz bir teklif isteği gelmemiştir.</p>
                    </section>
                    
                    <!-- ═══════════════════════════════════════════════════════ -->
                    <!-- 📞 İLETİŞİM BİLGİLERİ BÖLÜMÜ -->
                    <!-- ═══════════════════════════════════════════════════════ -->
                    <section id="section-contact" class="admin-section">
                        <div class="mb-6">
                            <h3 class="text-lg font-semibold text-white">İletişim Bilgileri</h3>
                            <p class="text-sm text-gray-400">Sitede görünen iletişim bilgilerini güncelleyin</p>
                        </div>
                        
                        <div class="admin-card p-6 max-w-2xl">
                            <form onsubmit="event.preventDefault(); window.saveContactInfo()">
                                <div class="mb-4">
                                    <label for="admin-contact-address" class="block text-sm font-medium text-gray-400 mb-2">Adres</label>
                                    <input type="text" id="admin-contact-address" required 
                                           class="admin-input w-full"
                                           placeholder="Örnek Mah. Elit Cad. No: 42/A Konak, İzmir / Türkiye">
                                </div>
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
                                    <div>
                                        <label for="admin-contact-phone" class="block text-sm font-medium text-gray-400 mb-2">Telefon</label>
                                        <input type="tel" id="admin-contact-phone" required 
                                               class="admin-input w-full"
                                               placeholder="+90 232 XXX XX XX">
                                    </div>
                                    <div>
                                        <label for="admin-contact-email" class="block text-sm font-medium text-gray-400 mb-2">E-posta</label>
                                        <input type="email" id="admin-contact-email" required 
                                               class="admin-input w-full"
                                               placeholder="info@firma.com">
                                    </div>
                                </div>
                                <button type="submit" class="admin-btn-primary flex items-center gap-2">
                                    <i data-lucide="save" class="w-4 h-4"></i> Kaydet
                                </button>
                            </form>
                        </div>
                    </section>
                    
                    <!-- ═══════════════════════════════════════════════════════ -->
                    <!-- ℹ️ HAKKIMIZDA BÖLÜMÜ -->
                    <!-- ═══════════════════════════════════════════════════════ -->
                    <section id="section-about" class="admin-section">
                        <div class="mb-6">
                            <h3 class="text-lg font-semibold text-white">Hakkımızda İçeriği</h3>
                            <p class="text-sm text-gray-400">Ana sayfadaki "Hakkımızda" bölümünü düzenleyin</p>
                        </div>
                        
                        <div class="admin-card p-6 max-w-2xl">
                            <form id="about-form" onsubmit="event.preventDefault(); window.saveAboutUs()">
                                <div class="mb-4">
                                    <label for="about-title" class="block text-sm font-medium text-gray-400 mb-2">Başlık</label>
                                    <input type="text" id="about-title" required
                                           class="admin-input w-full"
                                           placeholder="Örn: Neden Bizi Tercih Etmelisiniz?">
                                </div>
                                <div class="mb-6">
                                    <label for="about-content" class="block text-sm font-medium text-gray-400 mb-2">İçerik</label>
                                    <textarea id="about-content" rows="8" required
                                              class="admin-input w-full resize-none"
                                              placeholder="Firma tanıtımı, misyon, vizyon..."></textarea>
                                </div>
                                <button type="submit" class="admin-btn-primary flex items-center gap-2">
                                    <i data-lucide="save" class="w-4 h-4"></i> Kaydet
                                </button>
                            </form>
                        </div>
                    </section>
                    
                    <!-- ═══════════════════════════════════════════════════════ -->
                    <!-- ⚙️ SİTE AYARLARI BÖLÜMÜ -->
                    <!-- ═══════════════════════════════════════════════════════ -->
                    <section id="section-settings" class="admin-section">
                        <div class="mb-6">
                            <h3 class="text-lg font-semibold text-white">Site Ayarları</h3>
                            <p class="text-sm text-gray-400">Genel site ayarlarını yapılandırın</p>
                        </div>
                        
                        <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
                            <!-- Tema Ayarları -->
                            <div class="admin-card p-6">
                                <h4 class="text-md font-semibold text-white mb-4 flex items-center gap-2">
                                    <i data-lucide="palette" class="w-5 h-5 text-brand"></i>
                                    Tema Renkleri
                                </h4>
                                <div class="grid grid-cols-3 gap-3">
                                    <button onclick="window.changeTheme('gold')" class="theme-btn" data-theme="gold">
                                        <span class="w-6 h-6 rounded-full bg-yellow-500"></span>
                                        <span>Altın</span>
                                    </button>
                                    <button onclick="window.changeTheme('blue')" class="theme-btn" data-theme="blue">
                                        <span class="w-6 h-6 rounded-full bg-blue-500"></span>
                                        <span>Mavi</span>
                                    </button>
                                    <button onclick="window.changeTheme('green')" class="theme-btn" data-theme="green">
                                        <span class="w-6 h-6 rounded-full bg-green-500"></span>
                                        <span>Yeşil</span>
                                    </button>
                                    <button onclick="window.changeTheme('red')" class="theme-btn" data-theme="red">
                                        <span class="w-6 h-6 rounded-full bg-red-500"></span>
                                        <span>Kırmızı</span>
                                    </button>
                                    <button onclick="window.changeTheme('purple')" class="theme-btn" data-theme="purple">
                                        <span class="w-6 h-6 rounded-full bg-purple-500"></span>
                                        <span>Mor</span>
                                    </button>
                                    <button onclick="window.changeTheme('orange')" class="theme-btn" data-theme="orange">
                                        <span class="w-6 h-6 rounded-full bg-orange-500"></span>
                                        <span>Turuncu</span>
                                    </button>
                                </div>
                            </div>
                            
                            <!-- Firma Bilgileri -->
                            <div class="admin-card p-6">
                                <h4 class="text-md font-semibold text-white mb-4 flex items-center gap-2">
                                    <i data-lucide="building-2" class="w-5 h-5 text-brand"></i>
                                    Firma Bilgileri
                                </h4>
                                <form onsubmit="event.preventDefault(); window.saveCompanyInfo()">
                                    <div class="mb-4">
                                        <label class="block text-sm font-medium text-gray-400 mb-2">Firma Adı</label>
                                        <input type="text" id="setting-company-name" class="admin-input w-full" placeholder="Firma Adı">
                                    </div>
                                    <div class="mb-4">
                                        <label class="block text-sm font-medium text-gray-400 mb-2">Slogan</label>
                                        <input type="text" id="setting-company-slogan" class="admin-input w-full" placeholder="Firma Sloganı">
                                    </div>
                                    <button type="submit" class="admin-btn-primary flex items-center gap-2">
                                        <i data-lucide="save" class="w-4 h-4"></i> Kaydet
                                    </button>
                                </form>
                            </div>
                        </div>
                        
                        <!-- Config Önizleme (Geliştirici için) -->
                        <div class="admin-card p-6 mt-6">
                            <h4 class="text-md font-semibold text-white mb-4 flex items-center gap-2">
                                <i data-lucide="code" class="w-5 h-5 text-brand"></i>
                                Yapılandırma Önizleme
                            </h4>
                            <p class="text-sm text-gray-400 mb-3">Yeni müşteri için config dosyasını buradan kopyalayabilirsiniz.</p>
                            <pre id="config-preview" class="bg-slate-900 p-4 rounded-lg text-xs text-gray-300 overflow-x-auto max-h-64"></pre>
                            <button onclick="window.copyConfig()" class="admin-btn-secondary mt-3 flex items-center gap-2">
                                <i data-lucide="copy" class="w-4 h-4"></i> Config'i Kopyala
                            </button>
                        </div>
                    </section>
                    
                </div>
            </main>
        </div>
        
        <!-- Mobil Sidebar Overlay -->
        <div id="sidebar-overlay" class="sidebar-overlay" onclick="window.toggleAdminSidebar()"></div>
    </div>

    <div id="login-modal" class="fixed inset-0 bg-black bg-opacity-80 z-[400] hidden justify-center items-center p-4 transition duration-300 opacity-0" aria-modal="true" role="dialog">
    <div class="bg-slate-900 w-full max-w-md p-8 rounded-xl shadow-3xl transform scale-95 transition duration-300">
        <h2 class="text-3xl font-bold elite-text mb-6 text-center">Yönetici Girişi</h2>
        <form id="admin-login-form" onsubmit="event.preventDefault(); window.adminLogin()">
            
            <div class="mb-4">
                <label for="admin-email" class="block text-sm font-medium text-gray-400 mb-2">E-posta</label>
                <input type="email" id="admin-email" required 
                       class="w-full p-3 rounded-lg bg-slate-800 text-white border border-slate-700 focus:elite-border focus:ring focus:ring-yellow-500 focus:ring-opacity-50 transition duration-200" 
                       placeholder="E-postanızı Girin">
            </div>
            
            <div class="mb-4">
                <label for="admin-password" class="block text-sm font-medium text-gray-400 mb-2">Şifre</label>
                <input type="password" id="admin-password" required 
                       class="w-full p-3 rounded-lg bg-slate-800 text-white border border-slate-700 focus:elite-border focus:ring focus:ring-yellow-500 focus:ring-opacity-50 transition duration-200" 
                       placeholder="Şifrenizi Girin">
            </div>
            
            <p id="auth-status" class="mt-2 text-center text-sm text-red-400"></p>
            
            <button type="submit" 
                    class="w-full px-6 py-3 bg-yellow-400 bg-elite-text text-slate-900 font-bold rounded-full shadow-lg transition duration-300 mb-3">
                Giriş Yap
            </button>
            
            <!-- ✅ ŞİFREMİ UNUTTUM -->
            <div class="text-center mt-4 mb-3">
                <a href="/cdn-cgi/l/email-protection#543530393d3a14362e3f2d35243d7a373b396b2721363e3137206991ca3d3226317166640790e53290e5263835393571666400353831363d" class="text-sm text-yellow-400 hover:text-yellow-300 transition-colors underline">
                    Şifrenizi mi unuttunuz?
                </a>
            </div>
            
        </form>
        
        <!-- ✅ İptal butonu FORM'UN DIŞINDA -->
        <button type="button" 
                onclick="window.hideLoginModal()" 
                class="w-full px-6 py-3 bg-slate-800 text-gray-300 font-semibold rounded-full border border-slate-700 transition duration-300">
            İptal
        </button>
        
    </div>
</div>

    <!-- 4. PROJE EKLE/DÜZENLE MODAL (GÜNCELLENDİ) -->
    <div id="project-crud-modal" class="fixed inset-0 bg-black bg-opacity-80 z-[500] hidden justify-center items-center p-4 transition duration-300 opacity-0" aria-modal="true" role="dialog" onclick="if (event.target.id === 'project-crud-modal') ">
        <div class="bg-slate-900 w-full max-w-2xl max-h-[95vh] p-8 rounded-xl shadow-3xl overflow-y-auto transform scale-95 transition duration-300">
            <div class="flex justify-between items-center mb-6 border-b border-slate-700 pb-3">
                <h2 id="crud-modal-title" class="text-2xl font-bold text-white elite-text">Yeni Proje Ekle</h2>
                <button onclick="window.hideProjectModal()" class="text-gray-400 hover:text-elite-text text-3xl">×</button>
            </div>
            
            <form id="project-crud-form" onsubmit="event.preventDefault(); window.handleProjectSubmit(this)">
                <input type="hidden" id="project-id" name="id">

                <!-- Proje Başlığı -->
                <div class="mb-4">
                    <label for="project-title" class="block text-sm font-medium text-gray-400 mb-2">Başlık *</label>
                    <input type="text" id="project-title" name="title" required class="w-full p-3 rounded-lg bg-slate-800 text-white border border-slate-700" placeholder="Örn: Elite Konutları, Urla">
                </div>

                <!-- Durum ve Yıl -->
                <div class="grid grid-cols-2 gap-4 mb-4">
                    <div>
                        <label for="project-status" class="block text-sm font-medium text-gray-400 mb-2">Durum *</label>
                        <select id="project-status" name="status" required class="w-full p-3 rounded-lg bg-slate-800 text-white border border-slate-700">
                            <option value="ongoing">Devam Ediyor</option>
                            <option value="completed">Tamamlandı</option>
                        </select>
                    </div>
                    <div>
                        <label for="project-year" class="block text-sm font-medium text-gray-400 mb-2">Teslim Yılı</label>
                        <input type="number" id="project-year" name="year" class="w-full p-3 rounded-lg bg-slate-800 text-white border border-slate-700" placeholder="Örn: 2024">
                    </div>
                </div>

                <!-- Konum -->
                <div class="mb-4">
                    <label for="project-location" class="block text-sm font-medium text-gray-400 mb-2">Konum (İl ve İlçe)</label>
                    <input type="text" id="project-location" name="location" class="w-full p-3 rounded-lg bg-slate-800 text-white border border-slate-700" placeholder="İl ve ilçe giriniz (Örn: Konak, İzmir)">
                </div>
                
                <!-- ✨ YENİ: Detaylı Adres Alanı -->
                <div class="mb-4">
                    <label for="project-address" class="block text-sm font-medium text-gray-400 mb-2">Detaylı Adres (Opsiyonel)</label>
                    <textarea id="project-address" name="address" rows="3" class="w-full p-3 rounded-lg bg-slate-800 text-white border border-slate-700" placeholder="Mahalle, Cadde, Sokak, No, İlçe, İl (Örn: Atatürk Mahallesi, Cumhuriyet Caddesi, No: 123, Konak, İzmir)"></textarea>
                </div>
                
                <!-- YENİ: Proje İletişim Bilgileri -->
                <div class="mb-4 pt-4 border-t border-slate-700">
                    <h3 class="text-lg font-bold text-white mb-3 elite-text">Proje İletişim Bilgileri (Opsiyonel)</h3>
                    <div class="mb-4">
                        <label for="project-contact-person" class="block text-sm font-medium text-gray-400 mb-2">İletişim Kurulacak Kişi</label>
                        <input type="text" id="project-contact-person" name="contact_person" class="w-full p-3 rounded-lg bg-slate-800 text-white border border-slate-700" placeholder="Örn: Ayşe Yılmaz">
                    </div>
                    <div class="grid grid-cols-2 gap-4">
                        <div>
                            <label for="project-contact-phone" class="block text-sm font-medium text-gray-400 mb-2">Telefon</label>
                            <input type="tel" id="project-contact-phone" name="contact_phone" class="w-full p-3 rounded-lg bg-slate-800 text-white border border-slate-700" placeholder="Örn: +90 532 ...">
                        </div>
                        <div>
                            <label for="project-contact-email" class="block text-sm font-medium text-gray-400 mb-2">E-posta</label>
                            <input type="email" id="project-contact-email" name="contact_email" class="w-full p-3 rounded-lg bg-slate-800 text-white border border-slate-700" placeholder="Örn: ayse.y@bozkurt.com">
                        </div>
                    </div>
                </div>
                <!-- BİTTİ: Proje İletişim Bilgileri -->

                <!-- Görsel Yükleme Alanı (Drag & Drop + URL) -->
                <div class="mb-6 border border-slate-700 rounded-xl p-4 bg-slate-800">
                    <h3 class="text-lg font-bold text-white mb-3 elite-text">Görsel Yükle / Ekle</h3>

                    <!-- A. Sürükle-Bırak Alanı -->
                    <label class="block text-sm font-medium text-gray-400 mb-2">1. Yerel Görsel Yükleme (Sürükle & Bırak veya Tıkla)</label>
                    <div id="image-drop-zone" class="p-6 text-center rounded-lg cursor-pointer hover:bg-slate-700 transition duration-200" onclick="document.getElementById('file-input').click()">
                        <i data-lucide="upload" class="w-8 h-8 mx-auto text-gray-500 mb-2"></i>
                        <p class="text-gray-400 text-sm">Görselleri buraya sürükleyin veya tıklayarak seçin.</p>
                        <input type="file" id="file-input" multiple accept="image/*" class="hidden">
                    </div>

                    <!-- B. URL Ekleme Alanı -->
                    <div class="mt-4 pt-4 border-t border-slate-700">
                        <label class="block text-sm font-medium text-gray-400 mb-2">2. Veya Harici URL Yapıştırarak Ekle</label>
                        <div class="flex gap-2">
                             <input type="url" id="url-input" class="flex-grow p-3 rounded-lg bg-slate-900 text-white border border-slate-700 text-sm" placeholder="https://example.com/proje-fotografi.jpg">
                             <button type="button" id="add-url-btn" onclick="window.addUrlImage()" class="px-4 py-3 bg-blue-600 text-white font-semibold rounded-lg hover:bg-blue-700 transition duration-200">Ekle</button>
                        </div>
                    </div>

                    <p class="text-xs text-red-400 mt-4 p-1 bg-slate-900 rounded-lg">
                        ⚠️ **ÖNEMLİ:** Sürükle-bırak ile yüklenenler (Base64) 1MB belge limitine tabidir. Lütfen küçük dosyalar kullanın. Harici URL'ler bu limite takılmaz.
                    </p>
                    
                    <!-- Yüklenen Görsel Önizlemeleri -->
                    <div class="mt-4 pt-4 border-t border-slate-700">
                        <label class="block text-sm font-medium text-gray-400 mb-2">Tüm Görsel Önizlemeleri</label>
                        <div id="image-previews" class="flex flex-wrap gap-4 p-2 bg-slate-700 rounded-lg min-h-[50px]">
                            <p class="text-gray-500 text-sm italic p-2">Yüklenen görseller burada görünecek.</p>
                        </div>
                    </div>
                </div>
                <!-- BİTTİ: Görsel Yükleme Alanı -->

                <!-- Kısa Açıklama -->
                <div class="mb-4">
                    <label for="project-description" class="block text-sm font-medium text-gray-400 mb-2">Kısa Açıklama *</label>
                    <textarea type="text" id="project-description" name="description" required rows="3" class="w-full p-3 rounded-lg bg-slate-800 text-white border border-slate-700" placeholder="Ana sayfada görünecek kısa tanıtım metni."></textarea>
                </div>

                <!-- Detaylı Açıklama (LLM Entegre) -->
                <div class="mb-4">
                    <div class="flex justify-between items-center mb-2">
                        <label for="project-detailed-description" class="block text-sm font-medium text-gray-400">Detaylı Açıklama</label>
                        <button type="button" onclick="window.generateDetailedDescription()" class="flex items-center text-xs font-semibold px-3 py-1 bg-yellow-600 rounded-full hover:bg-yellow-500 transition duration-200 text-slate-900">
                            <i data-lucide="sparkles" class="w-4 h-4 mr-1"></i> ✨ Açıklama Oluştur
                        </button>
                    </div>
                    <textarea id="project-detailed-description" name="detailedDescription" rows="5" class="w-full p-3 rounded-lg bg-slate-800 text-white border border-slate-700" placeholder="Proje detay sayfasında görünecek uzun metin."></textarea>
                </div>
                
                <!-- İletişim Metni Oluşturma Alanı (LLM Entegre) -->
                <div class="mb-6 border border-slate-700 rounded-xl p-4 bg-slate-800">
                    <h3 class="text-lg font-bold text-white mb-3 elite-text flex items-center">
                        <i data-lucide="mail" class="w-5 h-5 mr-2"></i> ✨ Pazarlama Metni Oluştur
                    </h3>
                    
                    <div class="flex gap-2 mb-3">
                         <select id="communication-type" class="flex-grow p-3 rounded-lg bg-slate-900 text-white border border-slate-700 text-sm">
                             <option value="email">Müşteri E-posta Taslağı</option>
                             <option value="social">Sosyal Medya Gönderisi (X/Instagram)</option>
                             <option value="brief">Yatırımcı Brifingi (Özet)</option>
                         </select>
                         <button type="button" onclick="window.generateCommunicationText()" class="px-4 py-3 bg-green-600 text-white font-semibold rounded-lg hover:bg-green-700 transition duration-200 flex items-center">
                             <i data-lucide="bot" class="w-5 h-5 mr-1"></i> Oluştur
                         </button>
                    </div>
                    
                    <textarea id="communication-output" rows="5" class="w-full p-3 rounded-lg bg-slate-900 text-white border border-slate-700 text-sm" placeholder="Oluşturulan pazarlama metni burada görünecektir."></textarea>
                    
                    <p class="text-xs text-gray-500 mt-2">Bu araç, proje bilgilerini kullanarak hedef kitleye özel metinler oluşturur.</p>
                </div>
                <!-- BİTTİ: İletişim Metni Oluşturma Alanı -->

                <!-- Özellikler (Features) -->
                <div class="mb-6">
                    <label for="project-features" class="block text-sm font-medium text-gray-400 mb-2">Özellikler (Virgülle Ayırın)</label>
                    <input type="text" id="project-features" name="featuresString" class="w-full p-3 rounded-lg bg-slate-800 text-white border border-slate-700" placeholder="Örn: Akıllı Ev Sistemi, Yüzme Havuzu, Kapalı Otopark">
                </div>

                <button type="submit" class="w-full px-6 py-3 bg-elite-text bg-yellow-400 text-slate-900 font-bold rounded-full shadow-lg transition duration-300 transform hover:scale-[1.01]">
                    Kaydet
                </button>
            </form>
        </div>
    </div>


    <!-- 5. Utility Modals -->
    <!-- Mesaj Kutusu (Toast Notification) -->
    <div id="message-box" class="fixed bottom-5 right-5 bg-green-600 text-white p-4 rounded-lg shadow-xl transition-all duration-300 ease-in-out hidden z-[1000]">
        Mesajınız başarıyla gönderildi! Teşekkür ederiz.
    </div>

<div id="project-modal" 
     class="fixed inset-0 bg-black bg-opacity-75 z-[200] hidden justify-center items-center p-3 md:p-4 transition duration-300 opacity-0" 
     aria-modal="true" 
     role="dialog" 
     aria-labelledby="modal-title"
     onclick="if (event.target.id === 'project-modal') closeProjectModal()">
    
    <div class="bg-slate-900 w-full h-full md:max-w-6xl md:h-auto md:max-h-[95vh] md:rounded-xl shadow-3xl overflow-y-auto scrollbar-custom transition duration-300">
        <div class="flex justify-end p-4 sticky top-0 bg-slate-900/95 backdrop-blur-sm z-10 border-b border-slate-800">
            <button onclick="closeProjectModal()" class="text-gray-300 focus:outline-none text-3xl p-1" aria-label="Kapat">
                ×
            </button>
        </div>
        <div id="modal-content" class="p-4 sm:p-8 pt-0">
            <!-- Dinamik içerik buraya yüklenecek -->
        </div>
    </div>
</div>

    <!-- JavaScript for Functionality -->
    <script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script><script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script><script>
        // Lucide ikonlarını yükle
        lucide.createIcons();

        // --- GEMINI API AYARLARI ---
        const API_KEY = "AIzaSyCX5Vb_CvwTRbVbYqCZqDhnC84C1JlaRxo";
        const GEMINI_API_URL = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-05-20:generateContent?key=${API_KEY}`;
        
        // --- API Yardımcı Fonksiyonu (Exponential Backoff ile) ---
        async function fetchWithBackoff(url, options, maxRetries = 5) {
            for (let i = 0; i < maxRetries; i++) {
                try {
                    const response = await fetch(url, options);
                    if (response.status !== 429 && response.ok) {
                        return response.json();
                    }
                    if (response.status === 429 && i < maxRetries - 1) {
                        const delay = Math.pow(2, i) * 1000 + Math.random() * 1000;
                        await new Promise(resolve => setTimeout(resolve, delay));
                        continue;
                    }
                    
                    const errorJson = await response.json();
                    throw new Error(`API Hatası: ${response.status} - ${errorJson.error?.message || 'Bilinmeyen Hata'}`);
                } catch (error) {
                    if (i === maxRetries - 1) throw error; 
                    const delay = Math.pow(2, i) * 1000 + Math.random() * 1000;
                    await new Promise(resolve => setTimeout(resolve, delay));
                }
            }
        }
        
        // --- GEMINI API ENTEGRASYONU 1: Detaylı Açıklama Oluşturma ---
        window.generateDetailedDescription = async function() {
            const title = document.getElementById('project-title').value;
            const location = document.getElementById('project-location').value;
            const featuresString = document.getElementById('project-features').value;
            const description = document.getElementById('project-description').value;

            if (!title) {
                window.showMessage("Proje başlığı girilmelidir.", 'bg-red-600');
                return;
            }

            const prompt = `Act as a luxury construction marketing expert. Write a compelling, detailed, and persuasive project description (3-4 paragraphs, max 300 words) for a project titled "${title}" located in "${location}" (if available). Key features are: ${featuresString} (if available). Use this short description as inspiration: "${description}". Focus on quality, location, and elite lifestyle. Write the entire response in Turkish.`;
            
            window.showMessage("✨ Detaylı açıklama Gemini ile oluşturuluyor... Lütfen bekleyin.", 'bg-blue-600', 5000);

            try {
                const payload = {
                    contents: [{ parts: [{ text: prompt }] }],
                    systemInstruction: {
                        parts: [{ text: "You are a professional, sophisticated copywriter for a luxury construction firm. Write your response in fluent, high-quality Turkish, using marketing language suitable for elite real estate." }]
                    }
                };

                const result = await fetchWithBackoff(GEMINI_API_URL, {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json' },
                    body: JSON.stringify(payload)
                });

                const text = result.candidates?.[0]?.content?.parts?.[0]?.text;

                if (text) {
                    document.getElementById('project-detailed-description').value = text.trim();
                    window.showMessage("✨ Detaylı açıklama başarıyla oluşturuldu!", 'bg-green-600');
                } else {
                    window.showMessage("Açıklama oluşturulamadı. Lütfen prompt'u kontrol edin.", 'bg-red-600');
                }
            } catch (error) {
                console.error("Gemini API Hatası:", error);
                window.showMessage(`API hatası: Metin oluşturulamadı. ${error.message}`, 'bg-red-600', 8000);
            }
        };

        // --- GEMINI API ENTEGRASYONU 2: Pazarlama Metni Oluşturma (E-posta/Sosyal Medya/Brifing) ---
        window.generateCommunicationText = async function() {
            const title = document.getElementById('project-title').value;
            const location = document.getElementById('project-location').value;
            const featuresString = document.getElementById('project-features').value;
            const description = document.getElementById('project-description').value;
            const status = document.getElementById('project-status').value;
            const type = document.getElementById('communication-type').value;
            const outputArea = document.getElementById('communication-output');

            if (!title) {
                window.showMessage("Proje başlığı girilmelidir.", 'bg-red-600');
                return;
            }

            outputArea.value = ''; // Önceki çıktıyı temizle
            
            let systemPrompt = `You are a professional marketing specialist for 'Bozkurt İnşaat' in Turkey, focusing on luxury real estate. Generate the requested content using the provided project details. Write the entire response in Turkish.`;
            let userPrompt = `Proje Adı: ${title}. Konum: ${location}. Durum: ${status === 'completed' ? 'Tamamlandı' : 'Devam Ediyor'}. Temel Özellikler: ${featuresString}. Kısa Açıklama: ${description}.\n\n`;

            if (type === 'email') {
                systemPrompt += ` Your task is to draft a formal, personalized marketing email to a potential high-net-worth client. The email must be polite, engaging, highlight key features, and include a strong call-to-action for a site visit. Use a professional salutation and closing. Max 200 words.`;
                userPrompt += `Bu bilgileri kullanarak potansiyel bir müşteriye özel e-posta taslağı oluştur.`;
            } else if (type === 'social') {
                systemPrompt += ` Your task is to draft a short, visually appealing social media post (e.g., for Instagram/X) using emojis and hashtags. Focus on excitement, luxury, and the project status. Max 50 words.`;
                userPrompt += `Bu bilgileri kullanarak sosyal medya (Instagram/X) gönderisi taslağı oluştur (emoji ve hashtag kullan).`;
            } else if (type === 'brief') {
                systemPrompt += ` Your task is to draft a concise, objective summary for an investor briefing. Focus only on the project facts, status, and key investment highlights. Max 150 words.`;
                userPrompt += `Bu bilgileri kullanarak yatırımcılar için resmi, kısa bir proje brifingi özeti oluştur.`;
            }

            window.showMessage("✨ Pazarlama metni Gemini ile hazırlanıyor... Lütfen bekleyin.", 'bg-blue-600', 5000);

            try {
                const payload = {
                    contents: [{ parts: [{ text: userPrompt }] }],
                    systemInstruction: {
                        parts: [{ text: systemPrompt }]
                    }
                };

                const result = await fetchWithBackoff(GEMINI_API_URL, {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json' },
                    body: JSON.stringify(payload)
                });

                const text = result.candidates?.[0]?.content?.parts?.[0]?.text;

                if (text) {
                    outputArea.value = text.trim();
                    window.showMessage("✨ Metin başarıyla oluşturuldu!", 'bg-green-600');
                } else {
                    window.showMessage("Metin oluşturulamadı. Lütfen tekrar deneyin.", 'bg-red-600');
                }
            } catch (error) {
                console.error("Gemini API Hatası:", error);
                window.showMessage(`API hatası: Metin oluşturulamadı. ${error.message}`, 'bg-red-600', 8000);
            }
        };


        // --- GENEL UI VE YÖNETİM FONKSİYONLARI ---

        // Mesaj kutusu göster
        window.showMessage = function(message, bgColorClass = 'bg-green-600', duration = 3000) {
            const box = document.getElementById('message-box');
            box.textContent = message;
            box.className = 'fixed bottom-5 right-5 text-white p-4 rounded-lg shadow-xl transition-all duration-300 ease-in-out z-[1000] ' + bgColorClass;
            box.classList.remove('hidden', 'opacity-0');
            box.classList.add('opacity-100');

            setTimeout(() => {
                box.classList.remove('opacity-100');
                box.classList.add('opacity-0');
                setTimeout(() => box.classList.add('hidden'), 300);
            }, duration);
        }

        // Görünüm Değiştirme
        window.showView = function(viewId) {
            const mainView = document.getElementById('main-view');
            const adminView = document.getElementById('admin-view');

            if (viewId === 'admin') {
                mainView.classList.remove('visible-view');
                mainView.classList.add('hidden-view');
                adminView.classList.remove('hidden-view');
                adminView.classList.add('visible-view');
                document.body.classList.add('elite-bg'); 
                window.renderAdminProjectTable();
                window.renderAdminInquiryTable();
                window.updateAdminStats();
                window.updateAdminDate();
                window.showAdminSection('dashboard'); // Dashboard'u varsayılan olarak göster
            } else { // main
                adminView.classList.remove('visible-view');
                adminView.classList.add('hidden-view');
                mainView.classList.remove('hidden-view');
                mainView.classList.add('visible-view');
                window.renderProjects();
            }
            lucide.createIcons();
        }
        
        // ═══════════════════════════════════════════════════════════════════
        // 🎛️ ADMIN SIDEBAR FONKSİYONLARI
        // ═══════════════════════════════════════════════════════════════════
        
        // Admin bölüm değiştirme
        window.showAdminSection = function(sectionId) {
            // Tüm bölümleri gizle
            document.querySelectorAll('.admin-section').forEach(section => {
                section.classList.remove('active');
            });
            
            // Tüm menü öğelerinden active'i kaldır
            document.querySelectorAll('.admin-menu-item').forEach(item => {
                item.classList.remove('active');
            });
            
            // Seçilen bölümü göster
            const section = document.getElementById('section-' + sectionId);
            if (section) {
                section.classList.add('active');
            }
            
            // Seçilen menü öğesini aktif yap
            const menuItem = document.querySelector(`[data-section="${sectionId}"]`);
            if (menuItem) {
                menuItem.classList.add('active');
            }
            
            // Sayfa başlığını güncelle
            const titles = {
                dashboard: { title: 'Gösterge Paneli', subtitle: 'Genel bakış ve istatistikler' },
                projects: { title: 'Projeler', subtitle: 'Tüm projeleri yönetin' },
                inquiries: { title: 'Teklif İstekleri', subtitle: 'Müşteri taleplerini görüntüleyin' },
                contact: { title: 'İletişim Bilgileri', subtitle: 'Site iletişim bilgilerini düzenleyin' },
                about: { title: 'Hakkımızda', subtitle: 'Firma tanıtım içeriğini düzenleyin' },
                settings: { title: 'Site Ayarları', subtitle: 'Genel yapılandırma seçenekleri' }
            };
            
            const pageTitle = document.getElementById('admin-page-title');
            const pageSubtitle = document.getElementById('admin-page-subtitle');
            
            if (titles[sectionId]) {
                if (pageTitle) pageTitle.textContent = titles[sectionId].title;
                if (pageSubtitle) pageSubtitle.textContent = titles[sectionId].subtitle;
            }
            
            // Mobilde sidebar'ı kapat
            if (window.innerWidth < 1024) {
                window.toggleAdminSidebar(false);
            }
            
            lucide.createIcons();
        }
        
        // Sidebar toggle (mobil)
        window.toggleAdminSidebar = function(forceState) {
            const sidebar = document.getElementById('admin-sidebar');
            const overlay = document.getElementById('sidebar-overlay');
            
            if (typeof forceState === 'boolean') {
                sidebar.classList.toggle('open', forceState);
                overlay.classList.toggle('active', forceState);
            } else {
                sidebar.classList.toggle('open');
                overlay.classList.toggle('active');
            }
        }
        
        // Admin tarih güncelleme
        window.updateAdminDate = function() {
            const dateEl = document.getElementById('admin-current-date');
            if (dateEl) {
                const now = new Date();
                dateEl.textContent = now.toLocaleDateString('tr-TR', { 
                    weekday: 'long', 
                    day: 'numeric', 
                    month: 'long', 
                    year: 'numeric' 
                });
            }
        }
        
        // Badge güncelleme
        window.updateAdminBadges = function() {
            const projectBadge = document.getElementById('badge-projects');
            const inquiryBadge = document.getElementById('badge-inquiries');
            
            if (projectBadge) {
                projectBadge.textContent = window.projects?.length || 0;
            }
            
            if (inquiryBadge) {
                const pendingCount = window.inquiries?.filter(i => i.status === 'Yeni' || i.status === 'pending' || !i.status).length || 0;
                inquiryBadge.textContent = pendingCount;
                inquiryBadge.style.display = pendingCount > 0 ? 'inline' : 'none';
            }
        }
        
        // Config kopyalama
        window.copyConfig = function() {
            const config = {
                company: {
                    name: document.getElementById('setting-company-name')?.value || 'Firma Adı',
                    slogan: document.getElementById('setting-company-slogan')?.value || 'Firma Sloganı'
                },
                contact: window.contactInfo || {},
                theme: 'gold'
            };
            
            navigator.clipboard.writeText(JSON.stringify(config, null, 2))
                .then(() => window.showMessage('Config kopyalandı!', 'bg-green-600'))
                .catch(() => window.showMessage('Kopyalama başarısız!', 'bg-red-600'));
        }
        
        // Tema değiştirme (gelecek için)
        window.changeTheme = function(themeName) {
            document.querySelectorAll('.theme-btn').forEach(btn => {
                btn.classList.remove('active');
                if (btn.dataset.theme === themeName) {
                    btn.classList.add('active');
                }
            });
            window.showMessage(`${themeName.charAt(0).toUpperCase() + themeName.slice(1)} teması seçildi!`, 'bg-green-600');
        }

        // Mobile Menu Aç/Kapa
        window.setupMobileMenu = function() {
            const menuButton = document.getElementById('menu-button');
            const mobileMenu = document.getElementById('mobile-menu');
            const menuLinks = document.querySelectorAll('.menu-item-link');

            menuButton.addEventListener('click', () => {
                mobileMenu.classList.toggle('hidden');
                menuButton.setAttribute('aria-expanded', mobileMenu.classList.contains('hidden') ? 'false' : 'true');
            });

            menuLinks.forEach(link => {
                link.addEventListener('click', () => {
                    mobileMenu.classList.add('hidden');
                    menuButton.setAttribute('aria-expanded', 'false');
                });
            });
        }

        // --- PUBLIC SİTE RENDER İŞLEMLERİ ---

window.renderProjectCard = function(project) {
    const isCompleted = project.status === 'completed';
    const yearText = project.year ? `${project.year}` : '';
    const statusColor = isCompleted ? 'bg-gradient-to-r from-green-500 to-emerald-600' : 'bg-gradient-to-r from-yellow-500 to-amber-600';
    const statusText = isCompleted ? 'Tamamlandı' : 'Devam Ediyor';
    
    const imageUrl = project.images && project.images.length > 0 
        ? project.images[0] 
        : `https://placehold.co/400x300/475569/FACC15?text=${encodeURIComponent(project.title)}`;
    
    // Özelliklerden ilk 3'ünü göster
    const featuresPreview = project.features && project.features.length > 0 
        ? project.features.slice(0, 3).map(f => `
            <li class="flex items-center text-xs text-gray-400">
                <i data-lucide="check" class="w-3 h-3 mr-1.5 text-yellow-500 flex-shrink-0"></i>
                <span>${f}</span>
            </li>
        `).join('')
        : '';
    
    // Kart içi carousel için unique ID
    const cardId = `card-${project.id}`;
    const hasMultipleImages = project.images && project.images.length > 1;

    return `
        // ✅ YENİ KOD - Hafif animasyon
<div class="scroll-snap-card group rounded-2xl bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 shadow-2xl overflow-hidden transition-shadow duration-300 border border-slate-700/50 hover:border-yellow-500/50">
            <!-- Görsel Carousel -->
            <div class="relative h-56 overflow-hidden rounded-t-2xl">
                <div class="absolute inset-0 bg-gradient-to-t from-slate-900 via-transparent to-transparent z-10 opacity-60"></div>
                
                <!-- Carousel Container -->
                <div id="${cardId}-carousel" class="flex transition-transform duration-500 ease-in-out h-full" style="transform: translateX(0%);">
                    ${project.images && project.images.length > 0 
                        ? project.images.map((img, idx) => `
                            <img src="${img}" 
                                 loading="${idx === 0 ? 'eager' : 'lazy'}"
                                 decoding="async"
                                 alt="${project.title} - Görsel ${idx + 1}" 
                                 class="w-full h-full object-cover flex-shrink-0"
                                 onerror="this.onerror=null; this.src='https://placehold.co/400x300/475569/FACC15?text=Görsel+${idx+1}';"
                            >
                        `).join('')
                        : `<img src="${imageUrl}" loading="eager" decoding="async" alt="${project.title}" class="w-full h-full object-cover flex-shrink-0">`
                    }
                </div>
                
                <!-- Navigasyon Okları -->
                ${hasMultipleImages ? `
                <!-- ✅ Mobilde görünür, performanslı oklar -->
                <button onclick="window.cardCarouselPrev('${cardId}', ${project.images.length}); event.stopPropagation();" 
                class="card-nav-btn absolute left-2 top-1/2 -translate-y-1/2 bg-black/60 hover:bg-yellow-500 text-white hover:text-slate-900 p-2.5 rounded-full z-20 md:opacity-0 md:group-hover:opacity-100 opacity-80">
                    <i data-lucide="chevron-left" class="w-5 h-5"></i>
                </button>
                <button onclick="window.cardCarouselNext('${cardId}', ${project.images.length}); event.stopPropagation();" 
                        class="card-nav-btn absolute right-2 top-1/2 -translate-y-1/2 bg-black/60 hover:bg-yellow-500 text-white hover:text-slate-900 p-2.5 rounded-full z-20 md:opacity-0 md:group-hover:opacity-100 opacity-80">
                    <i data-lucide="chevron-right" class="w-5 h-5"></i>
                </button>
                
                <!-- Gösterge Noktaları -->
                <div class="absolute bottom-2 left-0 right-0 flex justify-center gap-1.5 z-20">
                    ${project.images.map((_, idx) => `
                        <span onclick="window.cardCarouselGoTo('${cardId}', ${idx}, ${project.images.length}); event.stopPropagation();" class="w-2 h-2 rounded-full ${idx === 0 ? 'bg-yellow-500' : 'bg-white/50'} transition-all cursor-pointer hover:scale-125" data-card="${cardId}" data-index="${idx}"></span>
                    `).join('')}
                </div>
                ` : ''}
                
                <span class="absolute top-4 right-4 ${statusColor} text-xs font-bold text-white px-3 py-1.5 rounded-full shadow-lg backdrop-blur-sm z-20">${statusText}</span>
                ${hasMultipleImages ? `<span class="absolute bottom-12 left-4 bg-black/50 backdrop-blur-sm text-xs text-white px-2 py-1 rounded-full z-20"><i data-lucide="images" class="w-3 h-3 inline mr-1"></i>${project.images.length} Görsel</span>` : ''}
            </div>
            
            <!-- İçerik -->
            <div class="p-6 space-y-4">
                <!-- Başlık ve Konum -->
                <div>
                    <h4 class="text-xl font-extrabold text-white elite-text mb-2 line-clamp-1 group-hover:text-yellow-400 transition-colors">${project.title}</h4>
                    <p class="text-xs text-gray-400 flex items-center gap-1.5">
                        <i data-lucide="map-pin" class="w-3.5 h-3.5 text-yellow-500"></i> 
                        <span>${project.location || 'Konum Belirtilmemiş'}${yearText ? ` • ${yearText}` : ''}</span>
                    </p>
                </div>
                
                <!-- Açıklama -->
                <p class="text-gray-400 text-sm leading-relaxed line-clamp-2">${project.description}</p>
                
                <!-- Özellikler Önizleme -->
                ${featuresPreview ? `<ul class="space-y-1.5 border-t border-slate-700/50 pt-3">${featuresPreview}</ul>` : ''}
                
                <!-- Detay Butonu -->
                <button onclick="window.showProjectModal('${project.id}')" class="w-full mt-4 bg-gradient-to-r from-yellow-500 to-amber-600 hover:from-yellow-400 hover:to-amber-500 text-slate-900 font-bold py-2.5 px-4 rounded-xl transition-all duration-300 flex items-center justify-center gap-2 shadow-lg hover:shadow-yellow-500/50 transform hover:-translate-y-0.5">
                    <span>Detayları Gör</span>
                    <i data-lucide="arrow-right" class="w-4 h-4"></i>
                </button>
            </div>
        </div>
    `;
}

// Kart carousel fonksiyonları
window.cardCarouselIndexes = {};

window.cardCarouselGoTo = function(cardId, index, totalImages) {
    window.cardCarouselIndexes[cardId] = index;
    window.updateCardCarousel(cardId, totalImages);
}

window.cardCarouselNext = function(cardId, totalImages) {
    if (!window.cardCarouselIndexes[cardId]) window.cardCarouselIndexes[cardId] = 0;
    window.cardCarouselIndexes[cardId] = (window.cardCarouselIndexes[cardId] + 1) % totalImages;
    window.updateCardCarousel(cardId, totalImages);
}

window.cardCarouselPrev = function(cardId, totalImages) {
    if (!window.cardCarouselIndexes[cardId]) window.cardCarouselIndexes[cardId] = 0;
    window.cardCarouselIndexes[cardId] = (window.cardCarouselIndexes[cardId] - 1 + totalImages) % totalImages;
    window.updateCardCarousel(cardId, totalImages);
}

window.updateCardCarousel = function(cardId, totalImages) {
    const carousel = document.getElementById(`${cardId}-carousel`);
    const currentIndex = window.cardCarouselIndexes[cardId] || 0;
    if (carousel) {
        // ✅ GPU hızlandırma için translate3d kullan
        carousel.style.transform = `translate3d(-${currentIndex * 100}%, 0, 0)`;
        carousel.style.transition = 'transform 0.3s ease-out';
        
        // Dot'ları güncelle
        document.querySelectorAll(`[data-card="${cardId}"]`).forEach((dot, idx) => {
            if (idx === currentIndex) {
                dot.classList.add('bg-yellow-500');
                dot.classList.remove('bg-white/50');
            } else {
                dot.classList.remove('bg-yellow-500');
                dot.classList.add('bg-white/50');
            }
        });
    }
}

// Touch Gesture Support for Card Carousels
window.initCardCarouselTouch = function(cardId, totalImages) {
    const carousel = document.getElementById(`${cardId}-carousel`);
    if (!carousel || !carousel.parentElement) return;
    
    const container = carousel.parentElement;
    let touchStartX = 0;
    let touchEndX = 0;
    
    container.addEventListener('touchstart', (e) => {
        touchStartX = e.changedTouches[0].screenX;
    }, { passive: true });
    
    container.addEventListener('touchend', (e) => {
        touchEndX = e.changedTouches[0].screenX;
        handleSwipe();
    }, { passive: true });
    
    function handleSwipe() {
        const swipeThreshold = 50;
        const diff = touchStartX - touchEndX;
        
        if (Math.abs(diff) > swipeThreshold) {
            if (diff > 0) {
                // Swipe left - next
                window.cardCarouselNext(cardId, totalImages);
            } else {
                // Swipe right - prev
                window.cardCarouselPrev(cardId, totalImages);
            }
        }
    }
}

// ✅ YENİ: Devam eden projeler için (grid layout) - Modern Tasarım + Navigasyon Okları
window.renderOngoingProjectCard = function(project) {
    const yearText = project.year ? `${project.year}` : '';
    
    const imageUrl = project.images && project.images.length > 0 
        ? project.images[0] 
        : `https://placehold.co/400x300/475569/FACC15?text=${encodeURIComponent(project.title)}`;
    
    // Özelliklerden ilk 3'ünü göster
    const featuresPreview = project.features && project.features.length > 0 
        ? project.features.slice(0, 3).map(f => `
            <li class="flex items-center text-xs text-gray-400">
                <i data-lucide="check" class="w-3 h-3 mr-1.5 text-yellow-500 flex-shrink-0"></i>
                <span>${f}</span>
            </li>
        `).join('')
        : '';
    
    // Kart içi carousel için unique ID
    const cardId = `card-${project.id}`;
    const hasMultipleImages = project.images && project.images.length > 1;

    return `
        <div class="group rounded-2xl bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 shadow-2xl overflow-hidden transform hover:scale-[1.03] hover:shadow-amber-500/20 transition-all duration-500 border border-slate-700/50 hover:border-amber-500/50">
            <!-- Görsel Carousel -->
            <div class="relative h-56 overflow-hidden rounded-t-2xl">
                <div class="absolute inset-0 bg-gradient-to-t from-slate-900 via-transparent to-transparent z-10 opacity-60"></div>
                
                <!-- Carousel Container -->
                <div id="${cardId}-carousel" class="flex transition-transform duration-500 ease-in-out h-full" style="transform: translateX(0%);">
                    ${project.images && project.images.length > 0 
                        ? project.images.map((img, idx) => `
                            <img src="${img}" 
                                 loading="${idx === 0 ? 'eager' : 'lazy'}"
                                 decoding="async"
                                 alt="${project.title} - Görsel ${idx + 1}" 
                                 class="w-full h-full object-cover flex-shrink-0"
                                 onerror="this.onerror=null; this.src='https://placehold.co/400x300/475569/FACC15?text=Görsel+${idx+1}';"
                            >
                        `).join('')
                        : `<img src="${imageUrl}" loading="eager" decoding="async" alt="${project.title}" class="w-full h-full object-cover flex-shrink-0">`
                    }
                </div>
                
                <!-- Navigasyon Okları -->
                ${hasMultipleImages ? `
                <!-- ✅ Mobilde görünür, performanslı oklar -->
<button onclick="window.cardCarouselPrev('${cardId}', ${project.images.length}); event.stopPropagation();" 
        class="card-nav-btn absolute left-2 top-1/2 -translate-y-1/2 bg-black/60 hover:bg-yellow-500 text-white hover:text-slate-900 p-2.5 rounded-full z-20 md:opacity-0 md:group-hover:opacity-100 opacity-80">
                    <i data-lucide="chevron-left" class="w-5 h-5"></i>
                </button>
                <button onclick="window.cardCarouselNext('${cardId}', ${project.images.length}); event.stopPropagation();" 
                        class="card-nav-btn absolute right-2 top-1/2 -translate-y-1/2 bg-black/60 hover:bg-yellow-500 text-white hover:text-slate-900 p-2.5 rounded-full z-20 md:opacity-0 md:group-hover:opacity-100 opacity-80">
                    <i data-lucide="chevron-right" class="w-5 h-5"></i>
                </button>
                
                <!-- Gösterge Noktaları -->
                <div class="absolute bottom-2 left-0 right-0 flex justify-center gap-1.5 z-20">
                    ${project.images.map((_, idx) => `
                        <span onclick="window.cardCarouselGoTo('${cardId}', ${idx}, ${project.images.length}); event.stopPropagation();" class="w-2 h-2 rounded-full ${idx === 0 ? 'bg-yellow-500' : 'bg-white/50'} transition-all cursor-pointer hover:scale-125" data-card="${cardId}" data-index="${idx}"></span>
                    `).join('')}
                </div>
                ` : ''}
                
                <span class="absolute top-4 right-4 bg-gradient-to-r from-yellow-500 to-amber-600 text-xs font-bold text-white px-3 py-1.5 rounded-full shadow-lg backdrop-blur-sm z-20 animate-pulse">Devam Ediyor</span>
                ${hasMultipleImages ? `<span class="absolute bottom-12 left-4 bg-black/50 backdrop-blur-sm text-xs text-white px-2 py-1 rounded-full z-20"><i data-lucide="images" class="w-3 h-3 inline mr-1"></i>${project.images.length} Görsel</span>` : ''}
            </div>
            
            <!-- İçerik -->
            <div class="p-6 space-y-4">
                <!-- Başlık ve Konum -->
                <div>
                    <h4 class="text-xl font-extrabold text-white elite-text mb-2 line-clamp-1 group-hover:text-yellow-400 transition-colors">${project.title}</h4>
                    <p class="text-xs text-gray-400 flex items-center gap-1.5">
                        <i data-lucide="map-pin" class="w-3.5 h-3.5 text-yellow-500"></i> 
                        <span>${project.location || 'Konum Belirtilmemiş'}${yearText ? ` • ${yearText}` : ''}</span>
                    </p>
                </div>
                
                <!-- Açıklama -->
                <p class="text-gray-400 text-sm leading-relaxed line-clamp-2">${project.description}</p>
                
                <!-- Özellikler Önizleme -->
                ${featuresPreview ? `<ul class="space-y-1.5 border-t border-slate-700/50 pt-3">${featuresPreview}</ul>` : ''}
                
                <!-- Detay Butonu - Minimal & Elegant -->
                <button onclick="window.showProjectModal('${project.id}')" class="details-btn w-full mt-4 bg-yellow-500 hover:bg-yellow-400 text-slate-900 font-semibold py-2.5 px-4 rounded-xl flex items-center justify-center gap-2">
                    <span>Detayları Gör</span>
                    <i data-lucide="arrow-right" class="w-4 h-4"></i>
                </button>
            </div>
        </div>
    `;
}

    window.renderProjects = function() {
    const completedContainer = document.getElementById('completed-projects-container');
    const ongoingContainer = document.getElementById('ongoing-projects-container');
    const noCompleted = document.getElementById('no-completed-projects');
    const noOngoing = document.getElementById('no-ongoing-projects');

    if (!completedContainer || !ongoingContainer) return;

    // ✅ İLK RENDER: Veri yoksa loading skeleton göster
    if (window.projects.length === 0) {
        const skeletonHTML = `
            <div class="animate-pulse bg-slate-800/50 rounded-2xl p-6 border border-slate-700/50">
                <div class="h-48 bg-slate-700/50 rounded-xl mb-4"></div>
                <div class="h-6 bg-slate-700/50 rounded w-3/4 mb-3"></div>
                <div class="h-4 bg-slate-700/50 rounded w-1/2"></div>
            </div>
        `;
        completedContainer.innerHTML = skeletonHTML + skeletonHTML;
        ongoingContainer.innerHTML = skeletonHTML;
        noCompleted.classList.add('hidden');
        noOngoing.classList.add('hidden');
        return;
    }

    // ✅ VERİ VARSA: Normal render
    completedContainer.innerHTML = '';
    ongoingContainer.innerHTML = '';
    
    // ✨ Order'a göre sırala
    const sortedProjects = [...window.projects].sort((a, b) => (a.order || 999) - (b.order || 999));
    const completed = sortedProjects.filter(p => p.status === 'completed');
    const ongoing = sortedProjects.filter(p => p.status === 'ongoing');

    // Tamamlanan projeler
    // ✅ PERFORMANS: innerHTML += yerine DocumentFragment
    if (completed.length > 0) {
        const fragment = document.createDocumentFragment();
        const tempDiv = document.createElement('div');
        completed.forEach(p => {
            tempDiv.innerHTML = window.renderProjectCard(p);
            fragment.appendChild(tempDiv.firstElementChild);
        });
        completedContainer.appendChild(fragment);
        noCompleted.classList.add('hidden');
        
        // Touch gesture'ları initialize et
        setTimeout(() => {
            completed.forEach(p => {
                if (p.images && p.images.length > 1) {
                    window.initCardCarouselTouch(`card-${p.id}`, p.images.length);
                }
            });
        }, 100);
    } else {
        completedContainer.innerHTML = '';
        noCompleted.classList.remove('hidden');
    }

    // Devam eden projeler
    if (ongoing.length > 0) {
        const fragment = document.createDocumentFragment();
        const tempDiv = document.createElement('div');
        ongoing.forEach(p => {
            tempDiv.innerHTML = window.renderOngoingProjectCard(p);
            fragment.appendChild(tempDiv.firstElementChild);
        });
        ongoingContainer.appendChild(fragment);
        noOngoing.classList.add('hidden');
        
        // Touch gesture'ları initialize et
        setTimeout(() => {
            ongoing.forEach(p => {
                if (p.images && p.images.length > 1) {
                    window.initCardCarouselTouch(`card-${p.id}`, p.images.length);
                }
            });
        }, 100);
    } else {
        ongoingContainer.innerHTML = '';
        noOngoing.classList.remove('hidden');
    }

    // ✅ PERFORMANS: RAF ile icon refresh
    requestAnimationFrame(() => lucide.createIcons());
}

window.renderContactInfo = function() {
    const info = window.contactInfo;
    console.log("renderContactInfo çalıştı, kullanılan veri:", info, "| timestamp:", new Date().toISOString());

    // 1. ADRES Güncelleme
    const addressEl = document.getElementById('contact-address-display');
    if (addressEl) {
        addressEl.textContent = info.address || "Adres bilgisi mevcut değil";
        console.log(`Adres güncellendi: "${addressEl.textContent}"`);
    } else {
        console.warn("⚠️ Adres elementi bulunamadı! DOM henüz hazır olmayabilir.");
    }

    // 2. TELEFON Güncelleme
    const phoneDisplayEl = document.getElementById('contact-phone-display');
    const phoneLinkEl = document.getElementById('contact-phone-link');
    if (phoneDisplayEl && phoneLinkEl && info.phone) {
        phoneDisplayEl.textContent = info.phone;
        phoneLinkEl.href = 'tel:' + info.phone.replace(/[^0-9+]/g, '');
        console.log("Telefon güncellendi:", info.phone);
    } else {
        console.warn("⚠️ Telefon elementleri veya veri eksik");
    }

    // 3. E-POSTA Güncelleme
    const emailDisplayEl = document.getElementById('contact-email-display');
    const emailLinkEl = document.getElementById('contact-email-link');
    if (emailDisplayEl && emailLinkEl && info.email) {
        emailDisplayEl.textContent = info.email;
        emailLinkEl.href = 'mailto:' + info.email;
        console.log("E-posta güncellendi:", info.email);
    } else {
        console.warn("⚠️ E-posta elementleri veya veri eksik");
    }
};

// Admin Formunu Doldur
window.populateContactForm = function() {
    const addressInput = document.getElementById('admin-contact-address');
    const phoneInput = document.getElementById('admin-contact-phone');
    const emailInput = document.getElementById('admin-contact-email');

    if (addressInput) addressInput.value = window.contactInfo.address || '';
    if (phoneInput) phoneInput.value = window.contactInfo.phone || '';
    if (emailInput) emailInput.value = window.contactInfo.email || '';
};

window.showProjectModal = function(id) {
    const project = window.projects.find(p => p.id === id);
    if (!project) return;

    const modal = document.getElementById('project-modal');
    const content = document.getElementById('modal-content');
    
    console.log('📸 Proje görselleri:', project.images);

    // ✅ YENİ RESPONSIVE GALLERY - Mobilde Carousel, Tablet/Desktop'ta Thumbnail Grid
    const hasImages = project.images && project.images.length > 0;
    let carouselHTML = '';
    
    if (hasImages) {
        carouselHTML = `
            <!-- MOBİL: Swipe Carousel (md altında) -->
            <div class="md:hidden relative overflow-hidden">
                <div id="mobile-carousel-track" class="flex overflow-x-auto snap-x snap-mandatory scrollbar-hide scroll-smooth">
                    ${project.images.map((imgSrc, index) => `
                        <div class="w-full flex-shrink-0 snap-center">
                            <div class="relative h-96 rounded-xl overflow-hidden mx-2">
                                <img 
                                    src="${imgSrc}" 
                                    loading="${index === 0 ? 'eager' : 'lazy'}"
                                    decoding="async"
                                    alt="${project.title} Görsel ${index + 1}" 
                                    class="w-full h-full object-cover"
                                    onerror="this.onerror=null; this.src='https://placehold.co/800x400/475569/FACC15?text=Görsel+${index+1}';"
                                >
                                <!-- Resim Numarası -->
                                <div class="absolute top-3 right-3 bg-slate-900/80 backdrop-blur-sm px-3 py-1.5 rounded-full">
                                    <span class="text-white text-sm font-bold">${index + 1}/${project.images.length}</span>
                                </div>
                            </div>
                        </div>
                    `).join('')}
                </div>
                
                ${project.images.length > 1 ? `
                <!-- Scroll İndikatörleri -->
                <div class="absolute bottom-6 left-0 right-0 flex justify-center space-x-2 z-20">
                    ${project.images.map((_, index) => `
                        <div 
                            id="mobile-carousel-dot-${index}"
                            class="w-2 h-2 rounded-full transition-all duration-300 ${index === 0 ? 'bg-yellow-500 w-6' : 'bg-gray-400'}"
                        ></div>
                    `).join('')}
                </div>
                ` : ''}
            </div>

            <!-- TABLET & DESKTOP: Tek Satır Yatay Scroll Gallery -->
            <div class="hidden md:block">
                <div class="relative">
                    ${project.images.length > 2 ? `
                    <!-- Sol Scroll Button -->
                    <button 
                        id="thumbnail-scroll-left" 
                        onclick="window.scrollThumbnailsLeft()" 
                        class="absolute left-0 top-1/2 -translate-y-1/2 bg-slate-900/90 hover:bg-yellow-500 text-yellow-400 hover:text-slate-900 p-3 rounded-full transition-all z-30 shadow-xl disabled:opacity-30 disabled:cursor-not-allowed"
                    >
                        <i data-lucide="chevron-left" class="w-5 h-5"></i>
                    </button>
                    
                    <!-- Sağ Scroll Button -->
                    <button 
                        id="thumbnail-scroll-right" 
                        onclick="window.scrollThumbnailsRight()" 
                        class="absolute right-0 top-1/2 -translate-y-1/2 bg-slate-900/90 hover:bg-yellow-500 text-yellow-400 hover:text-slate-900 p-3 rounded-full transition-all z-30 shadow-xl disabled:opacity-30 disabled:cursor-not-allowed"
                    >
                        <i data-lucide="chevron-right" class="w-5 h-5"></i>
                    </button>
                    ` : ''}
                    
                    <!-- Thumbnail Container - Snap Scroll ile Ortalama -->
                    <div id="thumbnail-main-container" class="overflow-x-auto scrollbar-hide scroll-smooth ${project.images.length > 2 ? 'px-12' : ''}" style="scroll-snap-type: x mandatory;">
                        <div class="flex gap-4">
                            ${project.images.map((imgSrc, index) => `
                                <div 
                                    onclick="window.openImageModal('${imgSrc.replace(/'/g, "\\'")}', '${project.title.replace(/'/g, "\\'")} - Görsel ${index + 1}', ${index})" 
                                    class="thumbnail-item cursor-pointer group relative rounded-xl overflow-hidden border-2 border-slate-700 hover:border-yellow-500 transition-all duration-300 transform hover:scale-105 shadow-lg hover:shadow-yellow-500/30 flex-shrink-0"
                                    style="scroll-snap-align: center;"
                                >
                                    <img 
                                        src="${imgSrc}" 
                                        loading="${index < 6 ? 'eager' : 'lazy'}"
                                        decoding="async"
                                        alt="${project.title} Görsel ${index + 1}" 
                                        class="w-full h-full object-cover transition-all duration-300 group-hover:brightness-75"
                                        onerror="this.onerror=null; this.src='https://placehold.co/400x300/475569/FACC15?text=${index+1}';"
                                    >
                                    <div class="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-end p-4">
                                        <span class="text-white text-sm font-semibold flex items-center gap-2">
                                            <i data-lucide="maximize-2" class="w-4 h-4"></i>
                                            Büyüt
                                        </span>
                                    </div>
                                    <!-- Resim Numarası -->
                                    <div class="absolute top-3 right-3 bg-slate-900/80 backdrop-blur-sm px-2 py-1 rounded-full">
                                        <span class="text-white text-xs font-bold">${index + 1}/${project.images.length}</span>
                                    </div>
                                </div>
                            `).join('')}
                        </div>
                    </div>
                </div>
            </div>
        `;
    } else {
        carouselHTML = `
            <div class="relative">
                <div class="h-96 rounded-xl overflow-hidden flex items-center justify-center bg-slate-700">
                    <p class="text-gray-400 text-xl">Görsel bulunmuyor</p>
                </div>
            </div>
        `;
    }
    
    // Thumbnail galerisi kaldırıldı - Artık yok
    const thumbnailGallery = '';

    // Tam HTML - YENİ MODERN TASARIM
    content.innerHTML = `
        <div class="space-y-0">
            <!-- Başlık Bölümü -->
            <div class="bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 -mx-4 sm:-mx-8 px-4 sm:px-8 py-8 border-b border-yellow-500/20">
                <div class="max-w-4xl mx-auto text-center">
                    <h1 id="modal-title" class="text-3xl md:text-5xl font-extrabold elite-text mb-4 tracking-tight">${project.title}</h1>
                    <div class="flex items-center justify-center gap-6 flex-wrap text-gray-300">
                        <div class="flex items-center gap-2 bg-slate-800/50 px-4 py-2 rounded-full border border-slate-700">
                            <i data-lucide="map-pin" class="w-4 h-4 text-yellow-400"></i>
                            <span class="text-sm font-medium">${project.location || 'Konum Belirtilmemiş'}</span>
                        </div>
                        <div class="flex items-center gap-2 bg-slate-800/50 px-4 py-2 rounded-full border border-slate-700">
                            <i data-lucide="calendar" class="w-4 h-4 text-yellow-400"></i>
                            <span class="text-sm font-medium">Teslim: ${project.year || 'Belirtilmemiş'}</span>
                        </div>
                        ${project.status === 'ongoing' ? `
                        <div class="flex items-center gap-2 bg-green-500/10 px-4 py-2 rounded-full border border-green-500/30">
                            <span class="w-2 h-2 bg-green-500 rounded-full animate-pulse"></span>
                            <span class="text-sm font-medium text-green-400">Devam Ediyor</span>
                        </div>
                        ` : project.status === 'completed' ? `
                        <div class="flex items-center gap-2 bg-blue-500/10 px-4 py-2 rounded-full border border-blue-500/30">
                            <i data-lucide="check-circle" class="w-4 h-4 text-blue-400"></i>
                            <span class="text-sm font-medium text-blue-400">Tamamlandı</span>
                        </div>
                        ` : ''}
                    </div>
                </div>
            </div>
            
            <!-- Carousel -->
            <div class="bg-slate-900 -mx-4 sm:-mx-8 px-4 sm:px-8 py-6">
                ${carouselHTML}
            </div>

            <!-- İçerik Grid -->
            <div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mt-8">
                <!-- Sol Kolon: Açıklama ve Özellikler (2/3) -->
                <div class="lg:col-span-2 space-y-6">
                    <!-- Proje Açıklaması -->
                    <div class="bg-gradient-to-br from-slate-800/50 to-slate-900/50 rounded-2xl p-6 border border-slate-700/50 hover:border-yellow-500/30 transition-all">
                        <div class="flex items-center gap-3 mb-4">
                            <div class="w-10 h-10 bg-yellow-500/20 rounded-xl flex items-center justify-center">
                                <i data-lucide="file-text" class="w-5 h-5 text-yellow-400"></i>
                            </div>
                            <h3 class="text-xl font-bold text-white">Proje Hakkında</h3>
                        </div>
                        <p class="text-gray-400 leading-relaxed whitespace-pre-wrap">${project.detailedDescription || project.description || 'Detaylı açıklama mevcut değil.'}</p>
                    </div>

                    <!-- Özellikler -->
                    ${(project.features && project.features.length > 0) ? `
                    <div class="bg-gradient-to-br from-slate-800/50 to-slate-900/50 rounded-2xl p-6 border border-slate-700/50 md:hover:border-yellow-500/30 transition-all">
                        <div class="flex items-center gap-3 mb-4">
                            <div class="w-10 h-10 bg-yellow-500/20 rounded-xl flex items-center justify-center">
                                <i data-lucide="star" class="w-5 h-5 text-yellow-400"></i>
                            </div>
                            <h3 class="text-xl font-bold text-white">Öne Çıkan Özellikler</h3>
                        </div>
                        <div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
                            ${project.features.map(f => `
                                <div class="flex items-start gap-3 p-3 rounded-xl bg-slate-900/50 md:hover:bg-slate-800/50 transition-all group">
                                    <i data-lucide="check-circle" class="w-5 h-5 text-yellow-400 flex-shrink-0 mt-0.5 md:group-hover:scale-110 transition-transform"></i>
                                    <span class="text-gray-300 text-sm font-medium">${f}</span>
                                </div>
                            `).join('')}
                        </div>
                    </div>
                    ` : ''}

                    <!-- Adres -->
                    ${project.address ? `
                    <div class="bg-gradient-to-br from-slate-800/50 to-slate-900/50 rounded-2xl p-6 border border-slate-700/50 hover:border-yellow-500/30 transition-all">
                        <div class="flex items-center gap-3 mb-4">
                            <div class="w-10 h-10 bg-yellow-500/20 rounded-xl flex items-center justify-center">
                                <i data-lucide="map-pin" class="w-5 h-5 text-yellow-400"></i>
                            </div>
                            <h3 class="text-xl font-bold text-white">Proje Konumu</h3>
                        </div>
                        <div class="flex items-start gap-3 p-4 rounded-xl bg-slate-900/50">
                            <i data-lucide="navigation" class="w-5 h-5 text-yellow-400 flex-shrink-0 mt-1"></i>
                            <p class="text-gray-300 leading-relaxed">${project.address}</p>
                        </div>
                    </div>
                    ` : ''}
                </div>

                <!-- Sağ Kolon: İletişim (1/3) -->
                ${(project.contact_person || project.contact_phone || project.contact_email) ? `
                <div class="lg:col-span-1">
                    <div class="sticky top-4 bg-gradient-to-br from-yellow-500/10 to-amber-600/10 rounded-2xl p-6 border-2 border-yellow-500/30 shadow-lg shadow-yellow-500/10">
                        <div class="text-center mb-6">
                            <div class="w-16 h-16 bg-yellow-500 rounded-full flex items-center justify-center mx-auto mb-4 shadow-lg shadow-yellow-500/50">
                                <i data-lucide="phone-call" class="w-8 h-8 text-slate-900"></i>
                            </div>
                            <h3 class="text-2xl font-bold text-white elite-text mb-2">İletişime Geçin</h3>
                            <p class="text-sm text-gray-400">Detaylı bilgi ve satış için</p>
                        </div>

                        <div class="space-y-3">
                            ${project.contact_phone ? `
                            <a href="tel:${project.contact_phone}" class="block group">
                                <div class="bg-slate-900/50 hover:bg-yellow-500/20 border border-slate-700 hover:border-yellow-500 rounded-xl p-4 transition-all">
                                    <div class="flex items-center gap-4">
                                        <div class="w-12 h-12 bg-yellow-500/20 group-hover:bg-yellow-500 rounded-xl flex items-center justify-center flex-shrink-0 transition-all">
                                            <i data-lucide="phone" class="w-5 h-5 text-yellow-400 group-hover:text-slate-900 transition-colors"></i>
                                        </div>
                                        <div class="flex-1 min-w-0">
                                            <p class="text-xs text-gray-500 mb-1">Telefon</p>
                                            <p class="text-white font-bold text-lg group-hover:text-yellow-400 transition-colors truncate">${project.contact_phone}</p>
                                        </div>
                                        <i data-lucide="chevron-right" class="w-5 h-5 text-gray-600 group-hover:text-yellow-400 transition-all opacity-0 group-hover:opacity-100"></i>
                                    </div>
                                </div>
                            </a>
                            ` : ''}

                            ${project.contact_person ? `
                            <div class="bg-slate-900/50 border border-slate-700 rounded-xl p-4">
                                <div class="flex items-center gap-4">
                                    <div class="w-12 h-12 bg-slate-700/50 rounded-xl flex items-center justify-center flex-shrink-0">
                                        <i data-lucide="user" class="w-5 h-5 text-yellow-400"></i>
                                    </div>
                                    <div class="flex-1 min-w-0">
                                        <p class="text-xs text-gray-500 mb-1">Yetkili Kişi</p>
                                        <p class="text-white font-semibold truncate">${project.contact_person}</p>
                                    </div>
                                </div>
                            </div>
                            ` : ''}

                            ${project.contact_email ? `
                            <a href="mailto:${project.contact_email}" class="block group">
                                <div class="bg-slate-900/50 hover:bg-yellow-500/20 border border-slate-700 hover:border-yellow-500 rounded-xl p-4 transition-all">
                                    <div class="flex items-center gap-4">
                                        <div class="w-12 h-12 bg-yellow-500/20 group-hover:bg-yellow-500 rounded-xl flex items-center justify-center flex-shrink-0 transition-all">
                                            <i data-lucide="mail" class="w-5 h-5 text-yellow-400 group-hover:text-slate-900 transition-colors"></i>
                                        </div>
                                        <div class="flex-1 min-w-0">
                                            <p class="text-xs text-gray-500 mb-1">E-posta</p>
                                            <p class="text-white font-semibold group-hover:text-yellow-400 transition-colors truncate">${project.contact_email}</p>
                                        </div>
                                        <i data-lucide="chevron-right" class="w-5 h-5 text-gray-600 group-hover:text-yellow-400 transition-all opacity-0 group-hover:opacity-100"></i>
                                    </div>
                                </div>
                            </a>
                            ` : ''}
                        </div>

                        <div class="mt-6 pt-6 border-t border-slate-700/50">
                            <div class="bg-slate-900/50 rounded-xl p-4 text-center">
                                <p class="text-xs text-gray-500 mb-2">Hemen arayın veya mesaj gönderin</p>
                                <div class="flex items-center justify-center gap-2 text-yellow-400">
                                    <i data-lucide="clock" class="w-4 h-4"></i>
                                    <span class="text-sm font-medium">7/24 Destek</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                ` : ''}
            </div>
        </div>
    `;
    
    lucide.createIcons();

    // ✅ History API - Modal açıldığında state ekle
    history.pushState({ modalOpen: true, modalType: 'project-detail', projectId: id }, '', '#proje-detay');

    modal.classList.remove('hidden', 'opacity-0');
    modal.classList.add('flex');
    setTimeout(() => modal.classList.add('opacity-100'), 10);
    
    // ✅ SCROLL İZOLASYONU - Sadece overflow hidden (pozisyon değişikliği yok)
    document.documentElement.classList.add('modal-open');
    document.body.classList.add('modal-open');
    
    // Global değişkenler
    window.currentCarouselImages = project.images || [];
    window.currentCarouselIndex = 0;
    
    window.setupKeyboardNav();
    
    // ✅ Thumbnail scroll butonlarını güncelle (tablet/desktop için)
    setTimeout(() => {
        if (window.updateThumbnailScrollButtons) {
            window.updateThumbnailScrollButtons();
        }
        // Alt galeri scroll butonlarını da güncelle
        if (window.updateBottomGalleryButtons) {
            window.updateBottomGalleryButtons();
        }
        // ✅ MOBİL CAROUSEL TRACKER'I BAŞLAT
        if (window.setupMobileCarouselTracker) {
            window.setupMobileCarouselTracker();
        }
    }, 100);
}

// ✅ Alt Thumbnail Galerisi Scroll Fonksiyonları
window.scrollBottomGalleryLeft = function() {
    const container = document.getElementById('bottom-gallery-container');
    if (!container) return;
    
    container.scrollBy({
        left: -300,
        behavior: 'smooth'
    });
    
    setTimeout(() => window.updateBottomGalleryButtons(), 100);
}

window.scrollBottomGalleryRight = function() {
    const container = document.getElementById('bottom-gallery-container');
    if (!container) return;
    
    container.scrollBy({
        left: 300,
        behavior: 'smooth'
    });
    
    setTimeout(() => window.updateBottomGalleryButtons(), 100);
}

window.updateBottomGalleryButtons = function() {
    const container = document.getElementById('bottom-gallery-container');
    const leftBtn = document.getElementById('bottom-scroll-left');
    const rightBtn = document.getElementById('bottom-scroll-right');
    
    if (!container || !leftBtn || !rightBtn) return;
    
    // Sol başta mı?
    if (container.scrollLeft <= 10) {
        leftBtn.disabled = true;
    } else {
        leftBtn.disabled = false;
    }
    
    // Sağ sonda mı?
    if (container.scrollLeft + container.clientWidth >= container.scrollWidth - 10) {
        rightBtn.disabled = true;
    } else {
        rightBtn.disabled = false;
    }
}

        window.closeProjectModal = function() {
        const modal = document.getElementById('project-modal');
        modal.classList.remove('opacity-100');
        modal.classList.add('opacity-0');
        
        // ✅ SCROLL İZOLASYONU - Sadece class kaldır (scroll pozisyonu korunur)
        document.documentElement.classList.remove('modal-open');
        document.body.classList.remove('modal-open');
        
        // Klavye listener'ı kaldır
        window.removeKeyboardNav();
        
        // ✅ URL'deki hash'i temizle (eğer history'den gelmediyse)
        if (window.location.hash === '#proje-detay') {
            history.back();
        }
    
        setTimeout(() => {
        modal.classList.remove('flex');
        modal.classList.add('hidden');
        }, 300);
        }

        // ✅ MOBİL CAROUSEL SCROLL TRACKER
        window.setupMobileCarouselTracker = function() {
            const track = document.getElementById('mobile-carousel-track');
            if (!track) return;
            
            track.addEventListener('scroll', () => {
                const scrollLeft = track.scrollLeft;
                const itemWidth = track.offsetWidth;
                const currentIndex = Math.round(scrollLeft / itemWidth);
                
                // Dot'ları güncelle
                const totalImages = window.currentCarouselImages?.length || 0;
                for (let i = 0; i < totalImages; i++) {
                    const dot = document.getElementById(`mobile-carousel-dot-${i}`);
                    if (dot) {
                        if (i === currentIndex) {
                            dot.classList.remove('bg-gray-400', 'w-2');
                            dot.classList.add('bg-yellow-500', 'w-6');
                        } else {
                            dot.classList.remove('bg-yellow-500', 'w-6');
                            dot.classList.add('bg-gray-400', 'w-2');
                        }
                    }
                }
            });
        };

        // ✅ YENİ CAROUSEL KONTROL FONKSİYONLARI
window.carouselGoTo = function(index) {
    if (!window.currentCarouselImages || window.currentCarouselImages.length === 0) return;
    
    const total = window.currentCarouselImages.length;
    
    // Eski slide'ı gizle
    const oldImg = document.getElementById(`carousel-img-${window.currentCarouselIndex}`);
    if (oldImg) {
        oldImg.style.opacity = '0';
        oldImg.style.zIndex = '1';
    }
    
    // Eski dot'u güncelle
    const oldDot = document.getElementById(`carousel-dot-${window.currentCarouselIndex}`);
    if (oldDot) {
        oldDot.classList.remove('bg-yellow-500', 'scale-110');
        oldDot.classList.add('bg-gray-400');
    }
    
    // Yeni slide'ı göster
    window.currentCarouselIndex = index;
    const newImg = document.getElementById(`carousel-img-${index}`);
    if (newImg) {
        newImg.style.opacity = '1';
        newImg.style.zIndex = '10';
    }
    
    // Yeni dot'u güncelle
    const newDot = document.getElementById(`carousel-dot-${index}`);
    if (newDot) {
        newDot.classList.remove('bg-gray-400');
        newDot.classList.add('bg-yellow-500', 'scale-110');
    }
    
    console.log('🎯 Carousel index:', index);
}

window.carouselNext = function() {
    if (!window.currentCarouselImages || window.currentCarouselImages.length === 0) return;
    const nextIndex = (window.currentCarouselIndex + 1) % window.currentCarouselImages.length;
    window.carouselGoTo(nextIndex);
}

window.carouselPrev = function() {
    if (!window.currentCarouselImages || window.currentCarouselImages.length === 0) return;
    const prevIndex = (window.currentCarouselIndex - 1 + window.currentCarouselImages.length) % window.currentCarouselImages.length;
    window.carouselGoTo(prevIndex);
}

// ✅ YENİ: Thumbnail Grid Scroll Fonksiyonları (Snap Scroll ile Ortalama)
window.scrollThumbnailsLeft = function() {
    const container = document.getElementById('thumbnail-main-container');
    if (!container) return;
    
    // Tam sayfa genişliği kadar kaydır
    const containerWidth = container.clientWidth;
    
    container.scrollBy({
        left: -containerWidth,
        behavior: 'smooth'
    });
    
    setTimeout(() => {
        window.updateThumbnailScrollButtons();
    }, 100);
}

window.scrollThumbnailsRight = function() {
    const container = document.getElementById('thumbnail-main-container');
    if (!container) return;
    
    const containerWidth = container.clientWidth;
    
    container.scrollBy({
        left: containerWidth,
        behavior: 'smooth'
    });
    
    setTimeout(() => {
        window.updateThumbnailScrollButtons();
    }, 100);
}

// Scroll butonlarını aktif/pasif yap
window.updateThumbnailScrollButtons = function() {
    const container = document.getElementById('thumbnail-main-container');
    const leftBtn = document.getElementById('thumbnail-scroll-left');
    const rightBtn = document.getElementById('thumbnail-scroll-right');
    
    if (!container || !leftBtn || !rightBtn) return;
    
    // Sol başta mı?
    if (container.scrollLeft <= 10) {
        leftBtn.disabled = true;
    } else {
        leftBtn.disabled = false;
    }
    
    // Sağ sonda mı?
    if (container.scrollLeft + container.clientWidth >= container.scrollWidth - 10) {
        rightBtn.disabled = true;
    } else {
        rightBtn.disabled = false;
    }
}

// ✅ YENİ: Image Modal (Büyük Görsel Gösterimi + Kaydırma)
window.openImageModal = function(imageSrc, imageTitle, imageIndex = 0) {
    // Global değişkenleri sakla
    window.currentFullscreenIndex = imageIndex;
    window.fullscreenImages = window.currentCarouselImages || [];
    
    // Modal oluştur
    const modalHtml = `
        <div id="image-fullscreen-modal" 
             class="fixed inset-0 bg-black/95 z-[300] flex items-center justify-center p-4 backdrop-blur-sm"
             onclick="window.closeImageModal()">
            <div class="relative max-w-7xl max-h-[95vh] w-full h-full flex items-center justify-center" onclick="event.stopPropagation()">
                <!-- Kapat Butonu -->
                <button 
                    onclick="window.closeImageModal()" 
                    class="absolute top-4 right-4 bg-slate-900/80 hover:bg-yellow-500 text-white hover:text-slate-900 p-3 rounded-full transition-all z-10"
                >
                    <i data-lucide="x" class="w-6 h-6"></i>
                </button>
                
                ${window.fullscreenImages.length > 1 ? `
                <!-- Sol Navigasyon -->
                <button 
                    onclick="window.fullscreenPrev()" 
                    class="absolute left-4 top-1/2 -translate-y-1/2 bg-slate-900/80 hover:bg-yellow-500 text-white hover:text-slate-900 p-4 rounded-full transition-all z-10 shadow-xl"
                >
                    <i data-lucide="chevron-left" class="w-7 h-7"></i>
                </button>
                
                <!-- Sağ Navigasyon -->
                <button 
                    onclick="window.fullscreenNext()" 
                    class="absolute right-4 top-1/2 -translate-y-1/2 bg-slate-900/80 hover:bg-yellow-500 text-white hover:text-slate-900 p-4 rounded-full transition-all z-10 shadow-xl"
                >
                    <i data-lucide="chevron-right" class="w-7 h-7"></i>
                </button>
                ` : ''}
                
                <!-- Ana Görsel -->
                <img 
                    id="fullscreen-image"
                    src="${imageSrc}" 
                    alt="${imageTitle}"
                    class="max-w-full max-h-full object-contain rounded-lg shadow-2xl transition-opacity duration-300"
                    onerror="this.onerror=null; this.src='https://placehold.co/800x600/475569/FACC15?text=Görsel+Yüklenemedi';"
                >
                
                <!-- Alt Bilgi -->
                <div class="absolute bottom-4 left-1/2 -translate-x-1/2 bg-slate-900/80 backdrop-blur-sm px-6 py-3 rounded-full flex items-center gap-3">
                    <span class="text-yellow-400 text-sm font-bold">${imageIndex + 1} / ${window.fullscreenImages.length}</span>
                    <span class="text-gray-400">•</span>
                    <p class="text-white text-sm font-semibold">${imageTitle}</p>
                </div>
            </div>
        </div>
    `;
    
    document.body.insertAdjacentHTML('beforeend', modalHtml);
    lucide.createIcons();
    
    // Klavye navigasyonu
    window.fullscreenKeyHandler = function(e) {
        if (e.key === 'Escape') {
            window.closeImageModal();
        } else if (e.key === 'ArrowLeft' && window.fullscreenImages.length > 1) {
            window.fullscreenPrev();
        } else if (e.key === 'ArrowRight' && window.fullscreenImages.length > 1) {
            window.fullscreenNext();
        }
    };
    document.addEventListener('keydown', window.fullscreenKeyHandler);
}

// Fullscreen'de önceki resim
window.fullscreenPrev = function() {
    if (!window.fullscreenImages || window.fullscreenImages.length === 0) return;
    
    window.currentFullscreenIndex = (window.currentFullscreenIndex - 1 + window.fullscreenImages.length) % window.fullscreenImages.length;
    window.updateFullscreenImage();
}

// Fullscreen'de sonraki resim
window.fullscreenNext = function() {
    if (!window.fullscreenImages || window.fullscreenImages.length === 0) return;
    
    window.currentFullscreenIndex = (window.currentFullscreenIndex + 1) % window.fullscreenImages.length;
    window.updateFullscreenImage();
}

// Fullscreen görsel güncelleme
window.updateFullscreenImage = function() {
    const img = document.getElementById('fullscreen-image');
    const modal = document.getElementById('image-fullscreen-modal');
    
    if (!img || !window.fullscreenImages) return;
    
    const newSrc = window.fullscreenImages[window.currentFullscreenIndex];
    const projectTitle = window.currentCarouselImages === window.fullscreenImages 
        ? document.getElementById('modal-title')?.textContent || 'Proje' 
        : 'Proje';
    
    // Fade out/in efekti
    img.style.opacity = '0';
    
    setTimeout(() => {
        img.src = newSrc;
        img.alt = `${projectTitle} - Görsel ${window.currentFullscreenIndex + 1}`;
        
        // Alt bilgiyi güncelle
        const infoDiv = modal.querySelector('.absolute.bottom-4');
        if (infoDiv) {
            infoDiv.innerHTML = `
                <span class="text-yellow-400 text-sm font-bold">${window.currentFullscreenIndex + 1} / ${window.fullscreenImages.length}</span>
                <span class="text-gray-400">•</span>
                <p class="text-white text-sm font-semibold">${projectTitle} - Görsel ${window.currentFullscreenIndex + 1}</p>
            `;
        }
        
        img.style.opacity = '1';
    }, 150);
}

window.closeImageModal = function() {
    const modal = document.getElementById('image-fullscreen-modal');
    if (modal) {
        modal.remove();
    }
    if (window.fullscreenKeyHandler) {
        document.removeEventListener('keydown', window.fullscreenKeyHandler);
        window.fullscreenKeyHandler = null;
    }
}
        
        // ✨ KLAVYE NAVİGASYONU (Ok Tuşları)
        window.keyboardNavHandler = null;
        
// Mevcut setupKeyboardNav fonksiyonunu bununla değiştir
window.setupKeyboardNav = function() {
    window.keyboardNavHandler = function(e) {
        if (e.key === 'ArrowLeft') {
            e.preventDefault();
            window.carouselPrev();
        } else if (e.key === 'ArrowRight') {
            e.preventDefault();
            window.carouselNext();
        } else if (e.key === 'Escape') {
            e.preventDefault();
            window.closeProjectModal();
        }
    };
    document.addEventListener('keydown', window.keyboardNavHandler);
}
        
        window.removeKeyboardNav = function() {
            if (window.keyboardNavHandler) {
                document.removeEventListener('keydown', window.keyboardNavHandler);
                window.keyboardNavHandler = null;
            }
        }
        
        // Carousel Navigasyon Fonksiyonları (Güncellendi - Scroll yerine Transform)
        window.moveCarousel = function(direction) {
            const carousel = document.getElementById('project-carousel');
            if (!carousel || !window.currentProjectCarousel || !window.currentProjectCarousel.images || window.currentProjectCarousel.images.length === 0) return;

            const totalSlides = window.currentProjectCarousel.images.length;
            let newIndex = window.currentSlideIndex;

            if (direction === 'next') {
                newIndex = (newIndex + 1) % totalSlides;
            } else if (direction === 'prev') {
                newIndex = (newIndex - 1 + totalSlides) % totalSlides;
            }
            
            window.goToSlide(newIndex);
        }
        // ✅ YENİ KOD - will-change kaldırıldı
window.goToSlide = function(index) {
    const carousel = document.getElementById('project-carousel');
    if (!carousel) return;
    
    carousel.style.transform = `translateX(-${index * 100}%)`;
    carousel.style.transition = 'transform 0.3s ease-out'; // Hızlandırıldı
    
    window.currentSlideIndex = index;
    window.updateCarouselDots();
}
        
        window.updateCarouselDots = function() {
            const dotsContainer = document.getElementById('carousel-dots');
            if (!dotsContainer) return;
            dotsContainer.querySelectorAll('.dot').forEach((dot, index) => {
                if (index === window.currentSlideIndex) {
                    dot.classList.add('bg-yellow-500', 'scale-110');
                    dot.classList.remove('bg-gray-400');
                } else {
                    dot.classList.remove('bg-yellow-500', 'scale-110');
                    dot.classList.add('bg-gray-400');
                }
            });
        }


        // --- ADMIN GİRİŞ İŞLEMLERİ ---
        
        // GÜNCELLENDİ: Admin girişi için klavye dinleyicisi
        window.setupAdminAccess = function() {
            const pressedKeys = new Set();
            const requiredKeys = ['Alt', 'b', 'z', 'k']; // 'Alt' yerine 'Meta' (Command) da olabilir, bu platformda Alt kullanıyoruz.

            document.addEventListener('keydown', (e) => {
                // Alt tuşunu da yakalamak için Alt veya Meta kontrolü ekleyebiliriz
                if (e.key === 'Alt') pressedKeys.add('Alt'); 
                
                // Küçük harfle tuş adını al
                const key = e.key.toLowerCase();
                if (requiredKeys.includes(key) && key !== 'Alt') {
                    pressedKeys.add(key);
                }

                if (requiredKeys.every(k => pressedKeys.has(k))) {
                    window.showLoginModal();
                    // Bir kez yakaladıktan sonra sıfırla
                    pressedKeys.clear();
                }
            });

            document.addEventListener('keyup', (e) => {
                const key = e.key.toLowerCase();
                pressedKeys.delete(key);
                if (e.key === 'Alt') pressedKeys.delete('Alt');
            });
            
            // Yedek admin butonu (UI'da gizli)
            document.getElementById('debug-admin-btn').onclick = window.showLoginModal;

            };
            window.adminLogin = async () => {
    const emailInput = document.getElementById('admin-email');
    const passwordInput = document.getElementById('admin-password');
    const statusText = document.getElementById('auth-status');

    // Firebase Auth'un hazır olmasını bekle
    if (!window.auth) {
        statusText.textContent = "Firebase başlatılıyor, lütfen bekleyin...";
        
        let attempts = 0;
        while (!window.auth && attempts < 50) {
            await new Promise(resolve => setTimeout(resolve, 200));
            attempts++;
        }
        
        if (!window.auth) {
            statusText.textContent = "Hata: Firebase Auth başlatılamadı.";
            return;
        }
    }

    const email = emailInput.value.trim();
    const password = passwordInput.value.trim();

    if (!email || !password) {
        statusText.textContent = "E-posta ve şifre girilmelidir.";
        return;
    }

    statusText.textContent = "Giriş yapılıyor...";

    try {
        // ✅ DÜZELTİLDİ: signInWithEmailAndPassword'ü import edin
        const { signInWithEmailAndPassword } = await import("https://www.gstatic.com/firebasejs/11.6.1/firebase-auth.js");
        
        const userCredential = await signInWithEmailAndPassword(window.auth, email, password);
        const user = userCredential.user;
        
        console.log("✅ GİRİŞ BAŞARILI:", user.email);
        
        window.isAdminLoggedIn = true;
        window.showMessage(`Yönetici Girişi Başarılı. Hoş geldiniz: ${user.email}`, 'bg-green-600');
        
        window.hideLoginModal();
        window.showView('admin'); 
        
        passwordInput.value = ''; 
        emailInput.value = '';
        statusText.textContent = '';
        
    } catch (error) {
        console.error("❌ TAM HATA DETAYI:", error);
        console.error("❌ Hata Kodu:", error.code);
        console.error("❌ Hata Mesajı:", error.message);
        
        let message = "Giriş başarısız oldu: E-posta veya şifre hatalı.";
        
        if (error.code === 'auth/invalid-email') {
            message = "Geçersiz e-posta formatı.";
        } else if (error.code === 'auth/invalid-credential') {
            message = "E-posta veya şifre hatalı. Firebase'de bu kullanıcı bulunamadı.";
        } else if (error.code === 'auth/user-not-found') {
            message = "Bu e-posta ile kayıtlı kullanıcı bulunamadı.";
        } else if (error.code === 'auth/wrong-password') {
            message = "Şifre hatalı.";
        } else if (error.code === 'auth/too-many-requests') {
            message = "Çok fazla başarısız deneme. Lütfen daha sonra tekrar deneyin.";
        } else if (error.code) {
            message = `Hata: ${error.code} - ${error.message}`;
        } else {
            message = `Bilinmeyen hata: ${error.message || 'Detay yok'}`;
        }
        
        statusText.textContent = message;
        window.showMessage(message, 'bg-red-600', 8000);
        passwordInput.value = ''; 
    }
};

            window.showLoginModal = function() {
            const modal = document.getElementById('login-modal');
            modal.classList.remove('hidden', 'opacity-0');
            modal.classList.add('flex');
            setTimeout(() => modal.classList.add('opacity-100'), 10);
            document.documentElement.classList.add('modal-open');
            document.body.classList.add('modal-open');
            }

            window.hideLoginModal = function() {
            const modal = document.getElementById('login-modal');
            modal.classList.remove('opacity-100');
            modal.classList.add('opacity-0');
            document.documentElement.classList.remove('modal-open');
            document.body.classList.remove('modal-open');
            setTimeout(() => modal.classList.add('hidden'), 300);
            }


            // --- ADMIN PROJE YÖNETİMİ TABLOSU ---
            window.renderAdminProjectTable = function() {
            const tableBody = document.getElementById('admin-project-table-body');
            const noProjectsMessage = document.getElementById('admin-no-projects-message');
            if (!tableBody) return;

            // ✅ Admin Stats Kartlarını Güncelle
            window.updateAdminStats();

            tableBody.innerHTML = ''; 

            if (window.projects.length === 0) {
                noProjectsMessage.classList.remove('hidden');
                tableBody.innerHTML = '<tr><td colspan="5" class="text-center py-8 text-gray-500">Henüz bir proje eklenmemiş.</td></tr>';
                return;
            }
            noProjectsMessage.classList.add('hidden');

            // ✨ Projeleri order'a göre sırala
            const sortedProjects = [...window.projects].sort((a, b) => (a.order || 999) - (b.order || 999));

            sortedProjects.forEach((project, index) => {
                const isCompleted = project.status === 'completed';
                const statusColor = isCompleted ? 'bg-gradient-to-r from-green-500 to-emerald-600' : 'bg-gradient-to-r from-yellow-500 to-amber-600';
                const statusText = isCompleted ? 'Tamamlandı' : 'Devam Ediyor';
                const isFirst = index === 0;
                const isLast = index === sortedProjects.length - 1;

                const row = document.createElement('tr');
                row.className = 'hover:bg-slate-800/50 transition duration-150';
                row.innerHTML = `
                    <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-white">${project.title}</td>
                    <td class="px-6 py-4 whitespace-nowrap">
                        <span class="px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${statusColor} text-slate-900 shadow-sm">${statusText}</span>
                    </td>
                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-400">${project.year || 'N/A'}</td>
                    <td class="px-6 py-4 whitespace-nowrap text-center">
                        <div class="flex items-center justify-center gap-2">
                            <button onclick="window.moveProject('${project.id}', 'up')" 
                                    ${isFirst ? 'disabled' : ''}
                                    class="p-1.5 rounded-lg bg-slate-700/50 text-yellow-500 hover:text-yellow-300 hover:bg-slate-600/50 transition ${isFirst ? 'opacity-30 cursor-not-allowed' : ''}" 
                                    aria-label="Yukarı Taşı">
                                <i data-lucide="arrow-up" class="w-4 h-4"></i>
                            </button>
                            <button onclick="window.moveProject('${project.id}', 'down')" 
                                    ${isLast ? 'disabled' : ''}
                                    class="p-1.5 rounded-lg bg-slate-700/50 text-yellow-500 hover:text-yellow-300 hover:bg-slate-600/50 transition ${isLast ? 'opacity-30 cursor-not-allowed' : ''}" 
                                    aria-label="Aşağı Taşı">
                                <i data-lucide="arrow-down" class="w-4 h-4"></i>
                            </button>
                        </div>
                    </td>
                    <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
                        <div class="flex items-center justify-end gap-2">
                            <button onclick="window.editProject('${project.id}')" class="p-2 rounded-lg bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 hover:text-blue-300 transition" aria-label="Düzenle">
                                <i data-lucide="square-pen" class="w-4 h-4"></i>
                            </button>
                            <button onclick="window.deleteProject('${project.id}')" class="p-2 rounded-lg bg-red-500/10 text-red-400 hover:bg-red-500/20 hover:text-red-300 transition" aria-label="Sil">
                                <i data-lucide="trash-2" class="w-4 h-4"></i>
                            </button>
                        </div>
                    </td>
                `;
                tableBody.appendChild(row);
            });
            lucide.createIcons();
        }
        
        // ✅ YENİ: Admin Stats Güncelleme Fonksiyonu
        window.updateAdminStats = function() {
            const totalProjects = window.projects?.length || 0;
            const ongoingProjects = window.projects?.filter(p => p.status !== 'completed').length || 0;
            const completedProjects = window.projects?.filter(p => p.status === 'completed').length || 0;
            const pendingInquiries = window.inquiries?.filter(i => i.status === 'Yeni' || i.status === 'pending' || !i.status).length || 0;
            
            const statTotal = document.getElementById('stat-total-projects');
            const statOngoing = document.getElementById('stat-ongoing-projects');
            const statCompleted = document.getElementById('stat-completed-projects');
            const statPending = document.getElementById('stat-pending-inquiries');
            
            if (statTotal) statTotal.textContent = totalProjects;
            if (statOngoing) statOngoing.textContent = ongoingProjects;
            if (statCompleted) statCompleted.textContent = completedProjects;
            if (statPending) statPending.textContent = pendingInquiries;
            
            // Badge'leri de güncelle
            window.updateAdminBadges();
        }
        
        // ✨ YENİ: Proje Sıralama Fonksiyonu
        // ✨ PROJE SIRALAMA - Firestore ile Çalışır Halde
        window.moveProject = async function(projectId, direction) {
            const projectIndex = window.projects.findIndex(p => p.id === projectId);
            if (projectIndex === -1) return;
            
            if (!db || !auth.currentUser) {
                window.showMessage('Veritabanı bağlantısı yok veya yetkiniz eksik.', 'bg-red-600');
                return;
            }
            
            // Order değerlerini güncelle
            const sortedProjects = [...window.projects].sort((a, b) => (a.order || 999) - (b.order || 999));
            const currentIndex = sortedProjects.findIndex(p => p.id === projectId);
            
            let project1, project2;
            
            if (direction === 'up' && currentIndex > 0) {
                // Yukarı taşı
                project1 = sortedProjects[currentIndex];
                project2 = sortedProjects[currentIndex - 1];
                
                const temp = project1.order !== undefined ? project1.order : currentIndex;
                project1.order = project2.order !== undefined ? project2.order : (currentIndex - 1);
                project2.order = temp;
            } else if (direction === 'down' && currentIndex < sortedProjects.length - 1) {
                // Aşağı taşı
                project1 = sortedProjects[currentIndex];
                project2 = sortedProjects[currentIndex + 1];
                
                const temp = project1.order !== undefined ? project1.order : currentIndex;
                project1.order = project2.order !== undefined ? project2.order : (currentIndex + 1);
                project2.order = temp;
            } else {
                return; // Hareket edilemez
            }
            
            // Firestore'a kaydet
            try {
    const batch = window.writeBatch(db);
    
    const ref1 = window.doc(db, window.PROJECT_COLLECTION_PATH, project1.id);
    batch.update(ref1, { order: project1.order });
    
    const ref2 = window.doc(db, window.PROJECT_COLLECTION_PATH, project2.id);
    batch.update(ref2, { order: project2.order });
    
    await batch.commit();
    
    // Local state'i güncelle
    window.projects = window.projects.map(p => {
        if (p.id === project1.id) return { ...p, order: project1.order };
        if (p.id === project2.id) return { ...p, order: project2.order };
        return p;
    });
    
    // Tabloyu yeniden render et
    window.renderAdminProjectTable();
    
    window.showMessage('✅ Proje sıralaması güncellendi!', 'bg-green-600');
} catch (error) {
    console.error('Sıralama hatası:', error);
    window.showMessage(`❌ Hata: ${error.message}`, 'bg-red-600');
}
        };

        window.renderAdminInquiryTable = function() {
    const tableBody = document.getElementById('admin-inquiry-table-body');
    const noInquiriesMessage = document.getElementById('admin-no-inquiries-message');
    if (!tableBody) return;

    tableBody.innerHTML = '';
    
    // Stats güncelle
    window.updateAdminStats();

    if (window.inquiries.length === 0) {
        noInquiriesMessage.classList.remove('hidden');
        tableBody.innerHTML = '<tr><td colspan="6" class="text-center py-8 text-gray-500">Henüz bir teklif isteği gelmemiştir.</td></tr>';
        return;
    }
    noInquiriesMessage.classList.add('hidden');

    window.inquiries.forEach(inquiry => {
        const date = new Date(inquiry.timestamp).toLocaleDateString('tr-TR', { day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit' });
        const summary = inquiry.message.length > 50 ? inquiry.message.substring(0, 50) + '...' : inquiry.message;
        const isNew = inquiry.status === 'Yeni' || inquiry.status === 'pending' || !inquiry.status;
        const statusColor = isNew ? 'bg-gradient-to-r from-red-500 to-rose-600' : 'bg-gradient-to-r from-green-500 to-emerald-600';
        const statusText = isNew ? 'Yeni' : 'Okundu';

        const row = document.createElement('tr');
        row.className = 'hover:bg-slate-800/50 transition duration-150';
        row.innerHTML = `
            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-white w-[15%]">${inquiry.name}</td>
            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-400 w-[20%]">
                <a href="mailto:${inquiry.email}" class="hover:text-yellow-400 transition">${inquiry.email}</a>
            </td>
            <td class="px-6 py-4 text-sm text-gray-300 truncate cursor-pointer hover:text-yellow-400 w-[30%]" onclick="window.showMessage('Tam Mesaj: ${inquiry.message.replace(/'/g, "\\'")}', 'bg-blue-600', 10000)" title="Mesajın tamamını görmek için tıklayın">${summary}</td>
            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-400 w-[15%]">${date}</td>
            <td class="px-6 py-4 whitespace-nowrap text-center w-[10%]">
                <button onclick="window.updateInquiryStatus('${inquiry.id}', '${isNew ? 'Okundu' : 'Yeni'}')" 
                        class="px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${statusColor} text-white hover:opacity-80 transition cursor-pointer shadow-sm">
                    ${statusText}
                </button>
            </td>
            <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium w-[10%]">
                <button onclick="window.deleteInquiry('${inquiry.id}')" class="p-2 rounded-lg bg-red-500/10 text-red-400 hover:bg-red-500/20 hover:text-red-300 transition" aria-label="Sil">
                    <i data-lucide="trash-2" class="w-4 h-4"></i>
                </button>
            </td>
        `;
        tableBody.appendChild(row);
    });
    
    lucide.createIcons();
}


        // --- PROJE CRUD MODAL İŞLEMLERİ ---
        window.openProjectModal = function(project = null) {
            const modal = document.getElementById('project-crud-modal');
            const form = document.getElementById('project-crud-form');
            form.reset(); 
            window.currentProjectImages = []; // Global görsel array'ini temizle
            document.getElementById('communication-output').value = ''; // İletişim çıktısını temizle

            document.getElementById('crud-modal-title').textContent = project ? 'Proje Düzenle' : 'Yeni Proje Ekle';
            document.getElementById('project-id').value = project ? project.id : '';
            
            if (project) {
                // Mevcut projeyi düzenle
                document.getElementById('project-title').value = project.title || '';
                document.getElementById('project-status').value = project.status || 'ongoing';
                document.getElementById('project-year').value = project.year || '';
                document.getElementById('project-location').value = project.location || '';
                document.getElementById('project-address').value = project.address || ''; // ✨ YENİ
                document.getElementById('project-description').value = project.description || '';
                document.getElementById('project-detailed-description').value = project.detailedDescription || '';
                document.getElementById('project-contact-person').value = project.contact_person || '';
                document.getElementById('project-contact-phone').value = project.contact_phone || '';
                document.getElementById('project-contact-email').value = project.contact_email || '';
                
                // Özellikler dizisini string'e çevir
                document.getElementById('project-features').value = project.features ? project.features.join(', ') : '';
                
                // Görselleri global array'e yükle
                if (project.images) {
                    window.currentProjectImages = [...project.images];
                }
            } else {
                // Yeni proje
                document.getElementById('project-status').value = 'ongoing';
            }
            
            window.renderImagePreviews(); // Önizlemeleri göster

            modal.classList.remove('hidden', 'opacity-0');
            modal.classList.add('flex');
            setTimeout(() => modal.classList.add('opacity-100'), 10);
            document.documentElement.classList.add('modal-open');
            document.body.classList.add('modal-open');
        }
        
        window.editProject = function(id) {
            const project = window.projects.find(p => p.id === id);
            if (project) {
                window.openProjectModal(project);
            } else {
                window.showMessage('Proje bulunamadı.', 'bg-red-600');
            }
        }
        
        window.hideProjectModal = function() {
            const modal = document.getElementById('project-crud-modal');
            modal.classList.remove('opacity-100');
            modal.classList.add('opacity-0');
            document.documentElement.classList.remove('modal-open');
            document.body.classList.remove('modal-open');
            setTimeout(() => modal.classList.add('hidden'), 300);
        }

        window.handleProjectSubmit = function(form) {
            const formData = new FormData(form);
            const data = {};
            formData.forEach((value, key) => data[key] = value);
            
            // year alanını sayıya çevir
            if (data.year) {
                data.year = parseInt(data.year, 10);
                if (isNaN(data.year)) {
                    data.year = null; // Sayı değilse null yap
                }
            } else {
                data.year = null;
            }

            window.saveProject(data);
        }
        
        // --- DRAG & DROP İŞLEMLERİ ---
        window.setupDragAndDrop = function() {
            const dropZone = document.getElementById('image-drop-zone');
            const fileInput = document.getElementById('file-input');
            if (!dropZone || !fileInput) return;

            // Drag enter/leave
            ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
                dropZone.addEventListener(eventName, preventDefaults, false);
            });

            function preventDefaults(e) {
                e.preventDefault();
                e.stopPropagation();
            }

            ['dragenter', 'dragover'].forEach(eventName => {
                dropZone.addEventListener(eventName, () => dropZone.classList.add('dragover'), false);
            });

            ['dragleave', 'drop'].forEach(eventName => {
                dropZone.addEventListener(eventName, () => dropZone.classList.remove('dragover'), false);
            });

            // Drop event
            dropZone.addEventListener('drop', handleDrop, false);

            function handleDrop(e) {
                const dt = e.dataTransfer;
                const files = dt.files;
                handleFiles(files);
            }

            // File Input change
            fileInput.addEventListener('change', (e) => {
                handleFiles(e.target.files);
            });

            function handleFiles(files) {
                [...files].forEach(window.processFile);
                // Input'u temizle ki aynı dosyayı tekrar seçebilsin
                fileInput.value = ''; 
            }
        };
        
        // URL'den görsel ekleme
        window.addUrlImage = function() {
            const urlInput = document.getElementById('url-input');
            const url = urlInput.value.trim();

            if (url && (url.startsWith('http://') || url.startsWith('https://'))) {
                window.currentProjectImages.push(url);
                window.renderImagePreviews();
                urlInput.value = '';
                window.showMessage("Harici görsel URL'i eklendi.", 'bg-blue-600');
            } else if (url) {
                window.showMessage("Geçersiz URL formatı.", 'bg-red-600');
            }
        };

        // Görseli kaldırma (Base64 veya URL)
        window.removeImage = function(index) {
            if (index > -1 && index < window.currentProjectImages.length) {
                window.currentProjectImages.splice(index, 1);
                window.renderImagePreviews();
                window.showMessage("Görsel kaldırıldı.", 'bg-yellow-600');
            }
        };
        
        // Base64'e dönüştürme ve global array'e ekleme
        window.processFile = function(file) {
            if (!file.type.startsWith('image/')) {
                window.showMessage(`${file.name}: Sadece görsel dosyaları kabul edilir.`, 'bg-red-600');
                return;
            }

            const reader = new FileReader();
            reader.onload = (e) => {
                // Base64 string'in boyutunu kontrol et (1MB sınırı için kaba kontrol)
                if (e.target.result.length > 1300000) { // ~1MB
                    window.showMessage(`${file.name}: Görsel boyutu çok büyük (1MB sınırı). Lütfen daha küçük bir dosya kullanın.`, 'bg-red-600', 8000);
                    return;
                }
                
                window.currentProjectImages.push(e.target.result);
                window.renderImagePreviews();
            };
            reader.onerror = (e) => {
                 window.showMessage(`${file.name}: Okuma hatası.`, 'bg-red-600');
            };
            reader.readAsDataURL(file);
        };
        
        // Görsel önizlemelerini render etme
        window.renderImagePreviews = function() {
            const container = document.getElementById('image-previews');
            if (!container) return;

            container.innerHTML = ''; // Önceki önizlemeleri temizle

            if (window.currentProjectImages.length === 0) {
                 container.innerHTML = '<p class="text-gray-500 text-sm italic p-2">Yüklenen görseller burada görünecek.</p>';
                 return;
            }

            window.currentProjectImages.forEach((src, index) => {
                const isBase64 = src.startsWith('data:');
                const badge = isBase64 
                    ? '<span class="absolute bottom-0 left-0 bg-yellow-500 text-[10px] font-bold px-1 rounded-tr-lg text-slate-900">BASE64</span>'
                    : '<span class="absolute bottom-0 left-0 bg-blue-500 text-[10px] font-bold px-1 rounded-tr-lg text-white">URL</span>';
                
                const previewHtml = `
                    <div class="preview-image-container rounded-lg overflow-hidden shadow-md border border-slate-600">
                        <img src="${src}" alt="Önizleme ${index + 1}" class="w-full h-full"
                            onerror="this.onerror=null; this.src='https://placehold.co/80x80/475569/FACC15?text=Hata';"
                        >
                        ${badge}
                        <button type="button" class="remove-image-btn" onclick="window.removeImage(${index})">×</button>
                    </div>
                `;
                container.innerHTML += previewHtml;
            });
        };
window.addEventListener('DOMContentLoaded', () => {
    // ═══════════════════════════════════════════════════════════════════
    // 🎨 WHITE LABEL CONFIG UYGULA
    // ═══════════════════════════════════════════════════════════════════
    window.applyConfig();
    
    window.renderProjects(); 
    window.setupMobileMenu();
    window.setupAdminAccess(); 
    window.setupDragAndDrop();
    
    // ✅ İletişim bilgilerini ilk yüklemede de render et
    if (window.contactInfo && Object.keys(window.contactInfo).length > 0) {
        window.renderContactInfo();
    }
    
    lucide.createIcons();
});

// ═══════════════════════════════════════════════════════════════════════════
// 🎨 WHITE LABEL - CONFIG UYGULAMA FONKSİYONU
// ═══════════════════════════════════════════════════════════════════════════
window.applyConfig = function() {
    // Config yüklü mü kontrol et
    if (typeof SITE_CONFIG === 'undefined') {
        console.warn('⚠️ site-config.js yüklenmedi, varsayılan ayarlar kullanılıyor.');
        return;
    }
    
    console.log('✅ Site config yüklendi:', SITE_CONFIG.company?.name);
    
    // 1. CSS Değişkenlerini uygula
    if (typeof getActiveColors === 'function') {
        const colors = getActiveColors();
        const root = document.documentElement;
        
        root.style.setProperty('--color-brand', colors.primary);
        root.style.setProperty('--color-brand-dark', colors.primaryDark);
        root.style.setProperty('--color-brand-light', colors.primaryLight);
        root.style.setProperty('--color-bg', colors.background);
        root.style.setProperty('--color-bg-light', colors.backgroundLight);
        root.style.setProperty('--color-bg-card', colors.backgroundCard);
        root.style.setProperty('--color-text', colors.text);
        root.style.setProperty('--color-text-muted', colors.textMuted);
        root.style.setProperty('--color-text-dark', colors.textDark);
    }
    
    // 2. Sayfa başlığını güncelle
    if (SITE_CONFIG.seo?.title) {
        document.title = SITE_CONFIG.seo.title;
    }
    
    // 3. Meta description güncelle
    const metaDesc = document.querySelector('meta[name="description"]');
    if (metaDesc && SITE_CONFIG.seo?.description) {
        metaDesc.setAttribute('content', SITE_CONFIG.seo.description);
    }
    
    // 4. Admin panelde firma adını göster
    const adminCompanyName = document.getElementById('admin-company-name');
    if (adminCompanyName && SITE_CONFIG.company?.shortName) {
        adminCompanyName.textContent = SITE_CONFIG.company.shortName;
    }
    
    // 5. Hero bölümünü güncelle (eğer content tanımlıysa)
    if (SITE_CONFIG.content?.hero) {
        const heroTitle = document.querySelector('.hero-title');
        const heroSubtitle = document.querySelector('.hero-description');
        const heroBadge = document.querySelector('.hero-subtitle');
        
        if (heroTitle && SITE_CONFIG.content.hero.title) {
            heroTitle.innerHTML = SITE_CONFIG.content.hero.title;
        }
        if (heroSubtitle && SITE_CONFIG.content.hero.subtitle) {
            heroSubtitle.textContent = SITE_CONFIG.content.hero.subtitle;
        }
        if (heroBadge && SITE_CONFIG.content.hero.badge) {
            heroBadge.textContent = SITE_CONFIG.content.hero.badge;
        }
    }
    
    // 6. Footer copyright yılını güncelle
    const footerYear = document.querySelector('footer p');
    if (footerYear) {
        const year = new Date().getFullYear();
        const companyName = SITE_CONFIG.company?.name || 'Firma';
        footerYear.innerHTML = `© ${year} ${companyName}. ${SITE_CONFIG.content?.footer?.copyright || 'Tüm Hakları Saklıdır.'}`;
    }
}

// ✅ Tarayıcı GERİ TUŞU ile modal kapatma
window.addEventListener('popstate', (event) => {
    const modal = document.getElementById('project-modal');
    
    // Eğer modal açıksa ve state'te modalOpen false ise kapat
    if (modal && !modal.classList.contains('hidden')) {
        const state = event.state;
        
        // State yoksa veya modalOpen false ise modalı kapat
        if (!state || !state.modalOpen) {
            modal.classList.remove('opacity-100');
            modal.classList.add('opacity-0');
            
            // ✅ SCROLL İZOLASYONU - Sadece class kaldır
            document.documentElement.classList.remove('modal-open');
            document.body.classList.remove('modal-open');
            
            // Klavye listener'ı kaldır
            if (window.removeKeyboardNav) {
                window.removeKeyboardNav();
            }
            
            setTimeout(() => {
                    modal.classList.add('hidden');
            }, 300);
        }
    }
});
    </script>
</body>
</html>

This policy crawled by Onyphe on the 2026-03-01 is sorted as securitytxt.

FireBounty © 2015-2026

Legal notices | Privacy policy