{{--
    MAGAZINE LAYOUT: Full-width hero, 3-column blog grid (newspaper/magazine style)
--}}

{{-- Custom HTML: Before Hero --}}
@if(!empty($activeLayout->custom_html_before_hero))
{!! $activeLayout->custom_html_before_hero !!}
@endif

{{-- ── HERO SECTION (FULL-WIDTH) ── --}}
<section class="hero-magazine">
    <div class="hero-magazine-bg"></div>
    <div class="hero-magazine-content">
        <div class="hero-magazine-inner">
            @guest
                @if($activeLayout->show_hero_subtitle ?? true)
                <p class="hero-subtitle">🎖️ Türkiye'nin Askeri Kariyer Platformu</p>
                @endif
                <h1 class="hero-magazine-title">
                    Kariyerine Giden Yolda Doğru Adres
                </h1>
                @if($activeLayout->show_hero_subtitle ?? true)
                <p class="hero-magazine-desc">
                    KPSS hazırlığından mülakat pratiklerine, forum tartışmalarından AI asistanına kadar.
                </p>
                @endif
                @if($activeLayout->show_hero_buttons ?? true)
                <div class="hero-actions" style="justify-content: flex-start">
                    <a href="{{ route('register') }}" class="btn-primary">🚀 Ücretsiz Başla</a>
                    <a href="{{ route('login') }}" class="btn-secondary">Giriş Yap</a>
                </div>
                @endif
            @else
                @if($activeLayout->show_hero_subtitle ?? true)
                <p class="hero-subtitle">👋 Hoş Geldiniz</p>
                @endif
                <h1 class="hero-magazine-title">
                    {{ auth()->user()->name }}, Seni Bekliyoruz
                </h1>
                @if($activeLayout->show_hero_subtitle ?? true)
                <p class="hero-magazine-desc">
                    Binlerce üyeyle birlikte öğren, paylaş ve başar.
                </p>
                @endif
                @if($activeLayout->show_hero_buttons ?? true)
                <div class="hero-actions" style="justify-content: flex-start">
                    <a href="{{ route('forum.index') }}" class="btn-primary">💬 Forum'a Katıl</a>
                    <a href="{{ route('blog.index') }}" class="btn-secondary">Blog Yazılarını Keşfet</a>
                </div>
                @endif
            @endguest
        </div>
    </div>
</section>

{{-- Custom HTML: After Hero --}}
@if(!empty($activeLayout->custom_html_after_hero))
{!! $activeLayout->custom_html_after_hero !!}
@endif

{{-- ── STATS SECTION ── --}}
@if(($activeLayout->show_stats_section ?? true) && array_sum($stats) > 0)
<div class="stats-ribbon">
    <div class="stats-ribbon-inner" style="grid-template-columns: repeat({{ $activeLayout->stats_columns ?? 4 }}, 1fr)">
        <div class="stat-ribbon-item">
            <div class="stat-number">{{ number_format($stats['users']) }}</div>
            <div class="stat-label">Aktif Üye</div>
        </div>
        <div class="stat-ribbon-item">
            <div class="stat-number">{{ number_format($stats['topics']) }}</div>
            <div class="stat-label">Forum Konusu</div>
        </div>
        <div class="stat-ribbon-item">
            <div class="stat-number">{{ number_format($stats['posts']) }}</div>
            <div class="stat-label">Blog Yazısı</div>
        </div>
        <div class="stat-ribbon-item">
            <div class="stat-number">{{ number_format($stats['questions']) }}</div>
            <div class="stat-label">Mülakat Sorusu</div>
        </div>
    </div>
</div>
@endif

{{-- Custom HTML: After Stats --}}
@if(!empty($activeLayout->custom_html_after_stats))
{!! $activeLayout->custom_html_after_stats !!}
@endif

{{-- ── BLOG POSTS (MAGAZINE STYLE) ── --}}
@if(($activeLayout->show_blog_section ?? true) && $recentPosts->isNotEmpty())
<section class="section magazine-blog-section">
    <div class="section-header">
        <div class="section-tag">📰 Blog</div>
        <h2 class="section-title">Son Yazılar</h2>
    </div>
    <div class="posts-grid magazine-grid" style="grid-template-columns: repeat({{ $activeLayout->blog_columns ?? 3 }}, 1fr)">
        @foreach($recentPosts->take($activeLayout->blog_limit ?? 9) as $post)
        <a href="{{ route('blog.show', $post->slug) }}" class="post-card-magazine">
            <div class="post-card-content">
                @if($post->category)
                    <span class="post-category-tag">{{ $post->category->name }}</span>
                @endif
                <h3 class="post-title-large">{{ $post->title }}</h3>
                <p class="post-excerpt">{{ Str::limit($post->excerpt ?? strip_tags($post->content), 100) }}</p>
                <div class="post-footer">
                    <span class="post-author">{{ $post->user?->name ?? 'Admin' }}</span>
                    <span class="post-views">👁️ {{ $post->views ?? 0 }}</span>
                </div>
            </div>
        </a>
        @endforeach
    </div>
    <div style="text-align: center; margin-top: 40px;">
        <a href="{{ route('blog.index') }}" class="btn-outline">Arşivi Gözat →</a>
    </div>
</section>
@endif

{{-- Custom HTML: Before CTA --}}
@if(!empty($activeLayout->custom_html_before_cta))
{!! $activeLayout->custom_html_before_cta !!}
@endif

{{-- ── CTA SECTION ── --}}
@if(($activeLayout->show_cta_section ?? true) && ($activeLayout->cta_position ?? 'bottom') !== 'none')
@guest
<section class="cta-magazine">
    <div class="cta-magazine-content">
        <h2 class="cta-magazine-title">Topluluğa Katıl</h2>
        <p class="cta-magazine-desc">Binlerce askeri kariyer adayıyla öğren, paylaş ve başar.</p>
        <div style="display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;">
            <a href="{{ route('register') }}" class="btn-primary">🚀 Hemen Başla</a>
            <a href="{{ route('blog.index') }}" class="btn-secondary">Devamını Oku</a>
        </div>
    </div>
</section>
@endguest
@endif

{{-- Custom HTML: After CTA --}}
@if(!empty($activeLayout->custom_html_after_cta))
{!! $activeLayout->custom_html_after_cta !!}
@endif

<style>
{{-- Magazine Hero --}}
.hero-magazine {
    position: relative;
    min-height: 500px;
    display: flex;
    align-items: center;
    background: {{ $activeTheme->hero_bg_gradient ?? 'linear-gradient(135deg, #0f172a 0%, #1a2744 100%)' }};
    overflow: hidden;
    padding: 80px 24px;
}

.hero-magazine-bg {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 20% 50%, rgba(59,130,246,0.1) 0%, transparent 50%),
                      radial-gradient(circle at 80% 80%, rgba(139,92,246,0.08) 0%, transparent 50%);
    opacity: 0.5;
}

.hero-magazine-content {
    position: relative;
    z-index: 10;
    width: 100%;
}

.hero-magazine-inner {
    max-width: 600px;
}

.hero-subtitle {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #86efac;
    margin-bottom: 12px;
}

.hero-magazine-title {
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 900;
    color: {{ $activeTheme->hero_title_color ?? '#ffffff' }};
    line-height: 1.1;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.hero-magazine-desc {
    font-size: 18px;
    color: {{ $activeTheme->hero_subtitle_color ?? 'rgba(255,255,255,0.8)' }};
    line-height: 1.6;
    margin-bottom: 32px;
    max-width: 550px;
}

{{-- Stats Ribbon --}}
.stats-ribbon {
    background: linear-gradient(135deg, #f0f9ff 0%, #f5f3ff 100%);
    padding: 32px 24px;
    border-top: 1px solid #e0e7ff;
    border-bottom: 1px solid #e0e7ff;
}

.stats-ribbon-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    gap: 20px;
}

.stat-ribbon-item {
    text-align: center;
}

.stat-ribbon-item .stat-number {
    font-size: 32px;
    font-weight: 900;
    background: linear-gradient(135deg, #2563eb, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.stat-ribbon-item .stat-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
}

{{-- Magazine Blog --}}
.magazine-blog-section {
    padding: 60px 24px;
}

.post-card-magazine {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #e5e7eb;
}

.post-card-magazine:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(37,99,235,0.15);
    border-color: #2563eb;
}

.post-card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.post-category-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #eff6ff;
    border-radius: 6px;
    color: #2563eb;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
    align-self: flex-start;
}

.post-title-large {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    line-height: 1.4;
    margin-bottom: 12px;
    flex-grow: 1;
}

.post-excerpt {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 16px;
    flex-grow: 1;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #9ca3af;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}

{{-- Magazine CTA --}}
.cta-magazine {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 60px 24px;
}

.cta-magazine-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    color: #ffffff;
}

.cta-magazine-title {
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 900;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.cta-magazine-desc {
    font-size: 16px;
    color: rgba(255,255,255,0.8);
    line-height: 1.6;
    margin-bottom: 28px;
}

@media (max-width: 1024px) {
    .stats-ribbon-inner {
        grid-template-columns: repeat(2, 1fr);
    }

    .magazine-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .hero-magazine {
        min-height: 400px;
        padding: 60px 20px;
    }

    .hero-magazine-title {
        font-size: 32px;
    }

    .hero-magazine-desc {
        font-size: 16px;
    }

    .stats-ribbon-inner {
        grid-template-columns: repeat(2, 1fr);
    }

    .magazine-grid {
        grid-template-columns: 1fr !important;
    }

    .hero-actions {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .cta-magazine {
        padding: 40px 20px;
    }

    .cta-magazine-title {
        font-size: 24px;
    }
}
</style>
