{{-- resources/views/page/agency/themes/default/header.blade.php --}}
<header class="site-header" id="siteHeader">
    <div class="header-container">
        <div class="header-content">
            {{-- Logo --}}
            <a href="{{ route('customer.agency.show', $agency->slug) }}" class="logo-link">
                @if($agency->logo)
                    <div class="logo-wrapper">
                        <img src="{{ asset('storage/' . $agency->logo) }}" alt="{{ $agency->name }}" class="logo-img">
                    </div>
                @else
                    <div class="logo-text">
                        <span class="logo-primary">{{ $agency->name }}</span>
                    </div>
                @endif
            </a>

            {{-- Desktop Navigation --}}
            <nav class="desktop-nav">
                <a href="{{ route('customer.agency.show', $agency->slug) }}" class="nav-link">
                    <span class="nav-text">Ana Sayfa</span>
                </a>

                @if(isset($productTypes) && $productTypes->isNotEmpty())
                    @if($productTypes->count() === 1)
                        @php
                            $singleProductType = $productTypes->first();
                            $singleTypeCode = $singleProductType->code;
                            $isTourType = in_array($singleTypeCode, ['kultur-turu', 'gunubirlik-tur']);
                        @endphp
                        <a href="{{ $isTourType ? route('customer.agency.tours.list', ['agency' => $agency->slug, 'type' => $singleTypeCode]) : route('customer.agency.show', $agency->slug) . '#' . $singleProductType->slug }}" class="nav-link">
                            <span class="nav-text">
                                @if($singleProductType->icon)
                                    <i class="{{ $singleProductType->icon }}"></i>
                                @endif
                                {{ $singleProductType->name }}
                            </span>
                        </a>
                    @else
                        <div class="nav-dropdown">
                            <button class="nav-link dropdown-trigger">
                                <span class="nav-text">Hizmetlerimiz</span>
                                <i class="fas fa-chevron-down dropdown-icon"></i>
                            </button>
                            <div class="dropdown-menu">
                                <div class="dropdown-inner">
                                    @foreach($productTypes as $productType)
                                        @php
                                            $typeCode = $productType->code;
                                            $isTourType = in_array($typeCode, ['kultur-turu', 'gunubirlik-tur']);
                                            $productTypeUrl = $isTourType
                                                ? route('customer.agency.tours.list', ['agency' => $agency->slug, 'type' => $typeCode])
                                                : route('customer.agency.show', $agency->slug) . '#' . $productType->slug;
                                        @endphp
                                        <a href="{{ $productTypeUrl }}" class="dropdown-item">
                                            @if($productType->icon)
                                                <div class="dropdown-icon-wrapper">
                                                    <i class="{{ $productType->icon }}"></i>
                                                </div>
                                            @endif
                                            <span>{{ $productType->name }}</span>
                                        </a>
                                    @endforeach
                                </div>
                            </div>
                        </div>
                    @endif
                @endif

                <a href="#about" class="nav-link">
                    <span class="nav-text">Hakkımızda</span>
                </a>

                <a href="#contact" class="nav-link">
                    <span class="nav-text">İletişim</span>
                </a>

                <a href="#contact" class="cta-button">
                    <span class="cta-icon">
                        <i class="fas fa-phone"></i>
                    </span>
                    <span class="cta-text">Bize Ulaşın</span>
                    <span class="cta-shine"></span>
                </a>
            </nav>

            {{-- Mobile Menu Toggle --}}
            <button class="mobile-toggle" id="mobileToggle" aria-label="Menü">
                <span class="hamburger-line"></span>
                <span class="hamburger-line"></span>
                <span class="hamburger-line"></span>
            </button>
        </div>
    </div>

    {{-- Mobile Navigation --}}
    <div class="mobile-nav" id="mobileNav">
        <div class="mobile-nav-inner">
            <a href="{{ route('customer.agency.show', $agency->slug) }}" class="mobile-nav-link">
                <i class="fas fa-home"></i>
                <span>Ana Sayfa</span>
            </a>

            @if(isset($productTypes) && $productTypes->isNotEmpty())
                <div class="mobile-nav-group">
                    <div class="mobile-nav-title">Hizmetlerimiz</div>
                    @foreach($productTypes as $productType)
                        @php
                            $mobileTypeCode = $productType->code;
                            $mobileIsTourType = in_array($mobileTypeCode, ['kultur-turu', 'gunubirlik-tur']);
                            $mobileProductTypeUrl = $mobileIsTourType
                                ? route('customer.agency.tours.list', ['agency' => $agency->slug, 'type' => $mobileTypeCode])
                                : route('customer.agency.show', $agency->slug) . '#' . $productType->slug;
                        @endphp
                        <a href="{{ $mobileProductTypeUrl }}" class="mobile-nav-link">
                            @if($productType->icon)
                                <i class="{{ $productType->icon }}"></i>
                            @endif
                            <span>{{ $productType->name }}</span>
                        </a>
                    @endforeach
                </div>
            @endif

            <a href="#about" class="mobile-nav-link">
                <i class="fas fa-info-circle"></i>
                <span>Hakkımızda</span>
            </a>

            <a href="#contact" class="mobile-nav-link">
                <i class="fas fa-envelope"></i>
                <span>İletişim</span>
            </a>

            <a href="#contact" class="mobile-cta-button">
                <i class="fas fa-phone"></i>
                <span>Bize Ulaşın</span>
            </a>
        </div>
    </div>
</header>

<style>
    /* ============================================
       HEADER CONTAINER & BASE STYLES
    ============================================ */
    .site-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 10000;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-bottom: 1px solid rgba(255, 255, 255, 0.18);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    }

    .site-header.scrolled {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(25px) saturate(200%);
        -webkit-backdrop-filter: blur(25px) saturate(200%);
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06),
                    0 0 0 1px rgba(0, 0, 0, 0.02);
    }

    .header-container {
        max-width: 1400px;
        margin: 0 auto;
        padding: 0 2rem;
    }

    .header-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 80px;
        transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .site-header.scrolled .header-content {
        height: 70px;
    }

    /* ============================================
       LOGO STYLES
    ============================================ */
    .logo-link {
        text-decoration: none;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        position: relative;
        z-index: 2;
        transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .logo-link:hover {
        transform: scale(1.02);
    }

    .logo-wrapper {
        position: relative;
    }

    .logo-img {
        height: 50px;
        width: auto;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.05));
    }

    .site-header.scrolled .logo-img {
        height: 45px;
    }

    .logo-text {
        position: relative;
    }

    .logo-primary {
        font-size: 1.75rem;
        font-weight: 800;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        font-family: var(--heading-font);
        letter-spacing: -0.02em;
        transition: all 0.3s ease;
    }

    .site-header.scrolled .logo-primary {
        font-size: 1.5rem;
    }

    /* ============================================
       DESKTOP NAVIGATION
    ============================================ */
    .desktop-nav {
        display: flex;
        align-items: center;
        gap: 2rem;
    }

    .nav-link {
        position: relative;
        color: #374151;
        text-decoration: none;
        font-weight: 500;
        font-size: 0.938rem;
        padding: 0.5rem 0.75rem;
        border-radius: 8px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: transparent;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 0.375rem;
    }

    .nav-text {
        position: relative;
    }

    .nav-link::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg,
            color-mix(in srgb, var(--primary) 8%, transparent),
            color-mix(in srgb, var(--secondary) 8%, transparent));
        border-radius: 8px;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .nav-link:hover::before {
        opacity: 1;
    }

    .nav-link:hover {
        color: var(--primary);
        transform: translateY(-1px);
    }

    .nav-link .nav-text::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 50%;
        transform: translateX(-50%) scaleX(0);
        width: 100%;
        height: 2px;
        background: linear-gradient(90deg, var(--primary), var(--secondary));
        border-radius: 2px;
        transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .nav-link:hover .nav-text::after {
        transform: translateX(-50%) scaleX(1);
    }

    /* ============================================
       DROPDOWN MENU
    ============================================ */
    .nav-dropdown {
        position: relative;
    }

    .dropdown-trigger {
        gap: 0.5rem;
    }

    .dropdown-icon {
        font-size: 0.75rem;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-dropdown:hover .dropdown-icon {
        transform: rotate(180deg);
    }

    .dropdown-menu {
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%) translateY(0.5rem);
        min-width: 280px;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding-top: 0.5rem; /* Invisible bridge for hover */
    }

    .nav-dropdown:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
        pointer-events: all;
        transform: translateX(-50%) translateY(0);
    }

    .dropdown-inner {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-radius: 16px;
        padding: 0.5rem;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12),
                    0 0 0 1px rgba(0, 0, 0, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.18);
    }

    .dropdown-item {
        display: flex;
        align-items: center;
        gap: 0.875rem;
        padding: 0.875rem 1rem;
        color: #374151;
        text-decoration: none;
        font-size: 0.938rem;
        font-weight: 500;
        border-radius: 10px;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        overflow: hidden;
    }

    .dropdown-item::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg,
            color-mix(in srgb, var(--primary) 10%, transparent),
            color-mix(in srgb, var(--secondary) 10%, transparent));
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .dropdown-item:hover::before {
        opacity: 1;
    }

    .dropdown-item:hover {
        color: var(--primary);
        transform: translateX(4px);
    }

    .dropdown-icon-wrapper {
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        border-radius: 10px;
        color: white;
        font-size: 0.938rem;
        box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 25%, transparent);
        transition: all 0.2s ease;
        position: relative;
        z-index: 1;
    }

    .dropdown-item:hover .dropdown-icon-wrapper {
        transform: scale(1.1) rotate(5deg);
        box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 35%, transparent);
    }

    /* ============================================
       CTA BUTTON
    ============================================ */
    .cta-button {
        position: relative;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        color: white;
        padding: 0.75rem 1.75rem;
        border-radius: 50px;
        text-decoration: none;
        font-weight: 600;
        font-size: 0.938rem;
        display: inline-flex;
        align-items: center;
        gap: 0.625rem;
        box-shadow: 0 4px 16px color-mix(in srgb, var(--primary) 35%, transparent);
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        overflow: hidden;
        isolation: isolate;
    }

    .cta-button::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, var(--secondary), var(--primary));
        opacity: 0;
        transition: opacity 0.3s ease;
        z-index: -1;
    }

    .cta-button:hover::before {
        opacity: 1;
    }

    .cta-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 45%, transparent);
    }

    .cta-icon {
        transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .cta-button:hover .cta-icon {
        transform: rotate(15deg) scale(1.1);
    }

    .cta-shine {
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
        transition: left 0.6s ease;
    }

    .cta-button:hover .cta-shine {
        left: 100%;
    }

    /* ============================================
       MOBILE TOGGLE
    ============================================ */
    .mobile-toggle {
        display: none;
        flex-direction: column;
        gap: 5px;
        background: none;
        border: none;
        padding: 0.5rem;
        cursor: pointer;
        z-index: 10001;
        transition: transform 0.3s ease;
    }

    .mobile-toggle:hover {
        transform: scale(1.1);
    }

    .hamburger-line {
        width: 24px;
        height: 2.5px;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        border-radius: 2px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-toggle.active .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translate(7px, 7px);
    }

    .mobile-toggle.active .hamburger-line:nth-child(2) {
        opacity: 0;
        transform: translateX(20px);
    }

    .mobile-toggle.active .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    /* ============================================
       MOBILE NAVIGATION
    ============================================ */
    .mobile-nav {
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    box-shadow 0.4s ease;
        box-shadow: none;
    }

    .mobile-nav.active {
        max-height: calc(100vh - 80px);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
    }

    .mobile-nav-inner {
        padding: 2rem;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .mobile-nav-link {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 1rem 1.25rem;
        color: #374151;
        text-decoration: none;
        font-weight: 500;
        font-size: 1rem;
        border-radius: 12px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: white;
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    .mobile-nav-link:hover,
    .mobile-nav-link:active {
        background: linear-gradient(135deg,
            color-mix(in srgb, var(--primary) 10%, white),
            color-mix(in srgb, var(--secondary) 10%, white));
        color: var(--primary);
        transform: translateX(8px);
        border-color: color-mix(in srgb, var(--primary) 20%, transparent);
    }

    .mobile-nav-link i {
        width: 20px;
        text-align: center;
        font-size: 1.125rem;
    }

    .mobile-nav-group {
        margin: 1rem 0;
    }

    .mobile-nav-title {
        font-weight: 700;
        font-size: 0.875rem;
        color: #6B7280;
        padding: 0.5rem 1.25rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .mobile-cta-button {
        margin-top: 1rem;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        color: white;
        padding: 1.125rem 1.5rem;
        border-radius: 16px;
        text-decoration: none;
        font-weight: 700;
        font-size: 1.063rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 35%, transparent);
        transition: all 0.3s ease;
    }

    .mobile-cta-button:hover,
    .mobile-cta-button:active {
        transform: scale(1.02);
        box-shadow: 0 12px 32px color-mix(in srgb, var(--primary) 45%, transparent);
    }

    /* ============================================
       RESPONSIVE STYLES
    ============================================ */
    @media (max-width: 1024px) {
        .desktop-nav {
            gap: 1.25rem;
        }

        .nav-link {
            font-size: 0.875rem;
            padding: 0.5rem 0.625rem;
        }

        .cta-button {
            padding: 0.625rem 1.5rem;
            font-size: 0.875rem;
        }
    }

    @media (max-width: 768px) {
        .header-container {
            padding: 0 1.25rem;
        }

        .desktop-nav {
            display: none;
        }

        .mobile-toggle {
            display: flex;
        }

        .header-content {
            height: 70px;
        }

        .site-header.scrolled .header-content {
            height: 65px;
        }

        .mobile-nav {
            top: 70px;
        }

        .mobile-nav.active {
            max-height: calc(100vh - 70px);
        }
    }

    @media (max-width: 480px) {
        .header-container {
            padding: 0 1rem;
        }

        .logo-img {
            height: 42px;
        }

        .site-header.scrolled .logo-img {
            height: 38px;
        }

        .logo-primary {
            font-size: 1.5rem;
        }

        .site-header.scrolled .logo-primary {
            font-size: 1.375rem;
        }

        .mobile-nav-inner {
            padding: 1.5rem 1rem;
        }

        .mobile-nav-link {
            padding: 0.875rem 1rem;
            font-size: 0.938rem;
        }
    }

    /* ============================================
       ACCESSIBILITY & ANIMATIONS
    ============================================ */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }

    /* Smooth scroll offset for fixed header */
    html {
        scroll-padding-top: 100px;
    }
</style>

<script>
    // Header scroll effect
    let lastScroll = 0;
    const header = document.getElementById('siteHeader');

    window.addEventListener('scroll', () => {
        const currentScroll = window.pageYOffset;

        if (currentScroll > 50) {
            header.classList.add('scrolled');
        } else {
            header.classList.remove('scrolled');
        }

        lastScroll = currentScroll;
    });

    // Mobile menu toggle
    const mobileToggle = document.getElementById('mobileToggle');
    const mobileNav = document.getElementById('mobileNav');

    mobileToggle.addEventListener('click', () => {
        mobileToggle.classList.toggle('active');
        mobileNav.classList.toggle('active');
        document.body.style.overflow = mobileNav.classList.contains('active') ? 'hidden' : '';
    });

    // Close mobile menu on link click
    document.querySelectorAll('.mobile-nav-link').forEach(link => {
        link.addEventListener('click', () => {
            mobileToggle.classList.remove('active');
            mobileNav.classList.remove('active');
            document.body.style.overflow = '';
        });
    });

    // Close mobile menu on escape key
    document.addEventListener('keydown', (e) => {
        if (e.key === 'Escape' && mobileNav.classList.contains('active')) {
            mobileToggle.classList.remove('active');
            mobileNav.classList.remove('active');
            document.body.style.overflow = '';
        }
    });
</script>
