<?php
require_once __DIR__ . '/config.php';

$pageTitle       = "İstanbul Karotçu | Profesyonel Karot Ekibi - " . SITE_NAME;
$metaDescription = "İstanbul'da deneyimli karotçu. Beton karot, duvar karot, klima karot ve beton kesme. İş güvenliği önlemleriyle, müsaitliğe göre hızlı keşif. " . PHONE_FORMATTED;
$currentPage     = "karotcu";
$canonicalUrl    = canonicalUrl('/karotcu');
$ogImage         = defaultOgImage();

$ilceler = json_decode((string)file_get_contents(__DIR__ . '/data/ilceler.json'), true);
if (!is_array($ilceler)) { $ilceler = []; }
usort($ilceler, function($a, $b) {
    return strcasecmp($a['name'], $b['name']);
});

include __DIR__ . '/inc/header.php';
?>

<main>
    <div class="border-b" style="background: var(--color-concrete); border-color: var(--color-line);">
        <div class="container mx-auto px-4 py-3">
            <nav class="text-sm" aria-label="Breadcrumb">
                <a href="/" class="hover:underline" style="color: var(--color-cta);">Ana Sayfa</a>
                <span class="mx-2 text-gray-400">/</span>
                <span class="text-gray-700">İstanbul Karotçu</span>
            </nav>
        </div>
    </div>

    <section style="background: linear-gradient(180deg, #0f1f3a 0%, #1f2a44 100%); color:#fff;">
        <div class="container mx-auto px-4 py-14 md:py-20">
            <div class="max-w-3xl">
                <h1 class="text-3xl md:text-5xl font-extrabold mb-4">İstanbul Karotçu Ekibi</h1>
                <p class="text-lg md:text-xl text-gray-200 mb-3">İstanbul genelinde beton, duvar, klima ve tesisat karotu uygulaması yapan saha ekibi; yılların pratiğiyle.</p>
                <p class="text-gray-300 mb-8">Su soğutmalı makineler, KKD ile iş güvenliği önlemleri ve net yazılı teklif. Acil veya planlı talepler için telefon/WhatsApp hattı.</p>
                <div class="flex flex-col sm:flex-row gap-3">
                    <a href="tel:<?php echo e(PHONE_TEL); ?>" class="font-bold py-4 px-7 rounded-md text-lg text-white" style="background-color: var(--color-cta);">
                        Karotçu Çağır: <?php echo e(PHONE_FORMATTED); ?>
                    </a>
                    <a href="#karotcu-ilceler" class="bg-white/10 hover:bg-white/15 border border-white/20 font-semibold py-4 px-7 rounded-md text-lg">
                        Hizmet Bölgesi Seç
                    </a>
                </div>
                <p class="text-sm text-gray-300 mt-4">
                    <strong class="text-white">Bulunduğunuz noktaya en yakın karotçu</strong> için
                    <a href="/en-yakin-karotcu" class="underline hover:text-orange-300" style="color:#fdba74;">En Yakın Karotçu sayfamıza</a>
                    da göz atabilirsiniz.
                </p>
            </div>
        </div>
    </section>

    <section class="py-14 bg-white">
        <div class="container mx-auto px-4">
            <div class="grid md:grid-cols-2 gap-10 max-w-5xl mx-auto items-start">
                <div>
                    <h2 class="text-2xl md:text-3xl font-extrabold mb-4" style="color: var(--color-ink);">Karotçu Kimdir, Ne Yapar?</h2>
                    <p class="text-gray-700 leading-relaxed mb-4">
                        Karotçu, betonarme yapılarda elmas uçlu makinelerle hassas delme ve kesim yapan saha uzmanıdır.
                        Klima/havalandırma geçişleri, tesisat hatları, asansör ve merdiven boşluğu açma, beton numune alma
                        gibi işlerde görev alır.
                    </p>
                    <ul class="space-y-2 text-[15px] text-gray-700">
                        <li class="flex gap-2"><span style="color: var(--color-cta);">&#10003;</span>Yılların saha tecrübesi</li>
                        <li class="flex gap-2"><span style="color: var(--color-cta);">&#10003;</span>Su soğutmalı, titreşimsiz uygulama</li>
                        <li class="flex gap-2"><span style="color: var(--color-cta);">&#10003;</span>İş güvenliği ekipmanı ve KKD ile çalışma</li>
                        <li class="flex gap-2"><span style="color: var(--color-cta);">&#10003;</span>Keşif sonrası yazılı teklif</li>
                    </ul>
                </div>
                <div class="border rounded-lg p-6" style="border-color: var(--color-line); background: var(--color-concrete);">
                    <h3 class="font-bold mb-3" style="color: var(--color-ink);">Karotçu Hizmet Alanları</h3>
                    <div class="grid grid-cols-2 gap-2 text-sm text-gray-700">
                        <div class="flex gap-2"><span style="color: var(--color-cta);">&#9656;</span>Beton Delme</div>
                        <div class="flex gap-2"><span style="color: var(--color-cta);">&#9656;</span>Duvar Karot</div>
                        <div class="flex gap-2"><span style="color: var(--color-cta);">&#9656;</span>Klima Karot</div>
                        <div class="flex gap-2"><span style="color: var(--color-cta);">&#9656;</span>Tesisat Karot</div>
                        <div class="flex gap-2"><span style="color: var(--color-cta);">&#9656;</span>Beton Kesme</div>
                        <div class="flex gap-2"><span style="color: var(--color-cta);">&#9656;</span>Merdiven Boşluğu</div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section id="karotcu-ilceler" class="py-14" style="background: var(--color-concrete);">
        <div class="container mx-auto px-4">
            <div class="max-w-3xl mb-8">
                <h2 class="text-2xl md:text-3xl font-extrabold mb-2" style="color: var(--color-ink);">Karotçu Hizmet Bölgeleri</h2>
                <p class="text-gray-600">İlçelere göre detaylı sayfalar. Özgün karotçu detayı yayınlanmış ilçelerde
                    karotçu sayfası, diğerlerinde doğrudan ilçe karot sayfası açılır.</p>
            </div>

            <div class="max-w-md mb-6">
                <input type="text" id="karotcu-ara" placeholder="İlçe adı ile arama yapın..."
                       class="w-full px-4 py-3 border rounded-md focus:outline-none focus:ring-2"
                       style="border-color: var(--color-line);">
            </div>

            <div id="karotcu-grid" class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
                <?php foreach ($ilceler as $ilce):
                    $slug          = ilceSlug($ilce['name']);
                    $bolgeFile     = __DIR__ . '/data/bolgeler/' . $slug . '.json';
                    $hasOriginal   = file_exists($bolgeFile);
                    $href          = $hasOriginal ? '/' . $slug . '-karotcu' : '/' . $slug . '-karot';
                    $labelSuffix   = $hasOriginal ? ' Karotçu'              : ' Karot';
                    $cardSubtitle  = $hasOriginal
                        ? 'Karotçu sayfası: ekip ve detay'
                        : 'İlçe karot sayfasına git';
                ?>
                <a href="<?php echo e($href); ?>"
                   class="karotcu-card bg-white border rounded-lg p-5 hover:border-orange-500 hover:shadow transition"
                   style="border-color: var(--color-line);">
                    <div class="flex items-baseline justify-between">
                        <h3 class="text-lg font-bold" style="color: var(--color-ink);"><?php echo e($ilce['name'] . $labelSuffix); ?></h3>
                        <span class="text-xs" style="color: var(--color-cta);">&rarr;</span>
                    </div>
                    <p class="text-sm text-gray-600 mt-2"><?php echo e($cardSubtitle); ?></p>
                </a>
                <?php endforeach; ?>
            </div>
        </div>
    </section>

    <section class="py-14" style="background: var(--color-ink); color:#fff;">
        <div class="container mx-auto px-4">
            <h2 class="text-2xl md:text-3xl font-extrabold mb-8">Neden Bizim Karotçu Ekibimiz?</h2>
            <div class="grid md:grid-cols-2 lg:grid-cols-4 gap-5">
                <?php
                $why = [
                    ['Saha Tecrübesi','Yılların İstanbul betonarme uygulama deneyimi.'],
                    ['Modern Ekipman','Elmas uçlu, su soğutmalı, titreşimsiz makineler.'],
                    ['İş Güvenliği','KKD, gözetim ve saha güvenliği önlemleri.'],
                    ['Net Fiyat','Keşif sonrası yazılı teklif, gizli maliyet yok.'],
                ];
                foreach ($why as $w): ?>
                <div class="bg-white/5 border border-white/10 rounded-lg p-5">
                    <h3 class="font-bold mb-1" style="color:#fdba74;"><?php echo e($w[0]); ?></h3>
                    <p class="text-gray-300 text-sm"><?php echo e($w[1]); ?></p>
                </div>
                <?php endforeach; ?>
            </div>
        </div>
    </section>

    <section class="py-14" style="background: var(--color-cta); color:#fff;">
        <div class="container mx-auto px-4 text-center">
            <h2 class="text-2xl md:text-4xl font-extrabold mb-3">Karotçu Ekibimizi Çağırın</h2>
            <p class="text-lg mb-8 opacity-95 max-w-2xl mx-auto">
                Hızlı keşif, sahada çap-derinlik değerlendirmesi, yazılı teklif.
            </p>
            <div class="flex flex-col sm:flex-row gap-3 justify-center">
                <a href="tel:<?php echo e(PHONE_TEL); ?>" class="bg-white font-bold py-4 px-7 rounded-md transition" style="color: var(--color-ink);">
                    Ara: <?php echo e(PHONE_FORMATTED); ?>
                </a>
                <a href="https://wa.me/<?php echo e(WHATSAPP); ?>?text=<?php echo urlencode('İstanbul karotçu hizmeti hakkında bilgi almak istiyorum.'); ?>" target="_blank" rel="noopener" class="bg-white/10 hover:bg-white/15 border border-white/30 font-semibold py-4 px-7 rounded-md transition">
                    WhatsApp ile Yaz
                </a>
            </div>
        </div>
    </section>
</main>

<script>
(function(){
    var input = document.getElementById('karotcu-ara');
    if (!input) return;
    function normalize(s){
        return s.toLowerCase().replace(/[çğıöşü]/g, function(m){
            return ({'ç':'c','ğ':'g','ı':'i','ö':'o','ş':'s','ü':'u'})[m];
        });
    }
    input.addEventListener('input', function(){
        var q = normalize(this.value.trim());
        document.querySelectorAll('.karotcu-card').forEach(function(card){
            var name = normalize(card.querySelector('h3').textContent);
            card.style.display = (name.indexOf(q) !== -1) ? '' : 'none';
        });
    });
})();
</script>

<?php
$breadcrumb = [
    '@type' => 'BreadcrumbList',
    'itemListElement' => [
        [ '@type' => 'ListItem', 'position' => 1, 'name' => 'Ana Sayfa',        'item' => SITE_URL . '/' ],
        [ '@type' => 'ListItem', 'position' => 2, 'name' => 'İstanbul Karotçu', 'item' => $canonicalUrl ],
    ],
];

$areaServed = [];
foreach ($ilceler as $ilce) {
    $areaServed[] = $ilce['name'] . ', İstanbul';
}

echo renderJsonLd([
    '@context' => 'https://schema.org',
    '@graph' => [
        $breadcrumb,
        [
            '@type' => 'WebPage',
            '@id'   => $canonicalUrl,
            'url'   => $canonicalUrl,
            'name'  => $pageTitle,
            'description' => $metaDescription,
            'inLanguage'  => 'tr-TR',
        ],
        [
            '@type' => 'Service',
            '@id'   => $canonicalUrl . '#service',
            'name'  => 'İstanbul Karotçu Hizmetleri',
            'serviceType' => 'Karot Delme ve Beton Kesme',
            'url'   => $canonicalUrl,
            'description' => $metaDescription,
            'image' => $ogImage,
            'provider' => [ '@id' => organizationId() ],
            'areaServed' => $areaServed,
        ],
        [
            '@type' => 'Organization',
            '@id'   => organizationId(),
            'name'  => SITE_NAME,
            'url'   => SITE_URL,
            'logo'  => SITE_URL . '/images/favicon.svg',
            'telephone' => PHONE_TEL,
            'email'     => EMAIL,
        ],
    ],
]);

include __DIR__ . '/inc/footer.php';
