@extends('frontend.layouts.app')
@section('title', 'Anime Blog — Rehberler, İncelemeler ve Öneriler | Animexe')
@section('meta_description', 'Animexe anime blogunda izleme rehberleri, anime incelemeleri, tür önerileri ve AI destekli içerikler keşfedin.')
@section('meta_keywords', 'anime blog, anime rehberi, anime inceleme, anime önerisi, animexe blog')
@section('og_type', 'website')
@push('styles')
<style>
.blog-hero{background:linear-gradient(180deg,rgba(12,12,26,.95) 0%,var(--bg) 100%);padding:calc(var(--nav-h) + 32px) 24px 36px;border-bottom:1px solid rgba(0,245,255,.12)}
.blog-hero h1{font-family:var(--font-display);font-size:1.6rem;font-weight:800;letter-spacing:.06em;text-transform:uppercase;margin-bottom:8px}
.blog-hero p{color:var(--text2);font-size:.95rem;max-width:520px}
.blog-grid{display:grid;grid-template-columns:1fr 300px;gap:32px;max-width:1200px;margin:0 auto}
.blog-card{
  background:linear-gradient(145deg,rgba(17,17,31,.95),rgba(10,10,20,.98));
  border:1px solid rgba(0,245,255,.1);border-radius:var(--r2);overflow:hidden;
  transition:transform .2s,box-shadow .22s,border-color .2s;
  display:flex;flex-direction:column;
}
.blog-card:hover{transform:translateY(-4px);border-color:rgba(255,45,125,.4);box-shadow:0 16px 48px rgba(0,0,0,.5),0 0 32px rgba(255,45,125,.1)}
.blog-thumb{aspect-ratio:16/9;overflow:hidden;background:var(--surface2)}
.blog-thumb img{width:100%;height:100%;object-fit:cover;transition:transform .3s}
.blog-card:hover .blog-thumb img{transform:scale(1.05)}
.blog-thumb-ph{width:100%;height:100%;display:flex;align-items:center;justify-content:center;color:var(--text3);font-size:2.5rem}
.blog-body{padding:18px;flex:1;display:flex;flex-direction:column}
.blog-category{font-size:.68rem;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:var(--accent2);margin-bottom:8px}
.blog-title{font-size:.95rem;font-weight:700;color:var(--text);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin-bottom:8px}
.blog-excerpt{font-size:.8rem;color:var(--text2);line-height:1.55;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;flex:1}
.blog-footer{display:flex;align-items:center;justify-content:space-between;margin-top:14px;padding-top:12px;border-top:1px solid rgba(0,245,255,.08)}
.blog-date{font-size:.72rem;color:var(--text3)}
.blog-read{font-size:.72rem;color:var(--text3);display:flex;align-items:center;gap:4px}
.blog-ai-badge{display:inline-flex;align-items:center;gap:4px;font-size:.65rem;font-weight:700;
  padding:2px 8px;border-radius:999px;background:rgba(124,58,237,.2);border:1px solid rgba(124,58,237,.3);
  color:#a78bfa;margin-bottom:8px}
.sidebar-card{background:rgba(17,17,31,.8);border:1px solid rgba(0,245,255,.1);border-radius:var(--r2);padding:18px;margin-bottom:20px}
.sidebar-title{font-family:var(--font-display);font-size:.72rem;text-transform:uppercase;letter-spacing:.1em;color:var(--accent2);margin-bottom:14px;font-weight:700}
.sidebar-item{display:flex;gap:10px;padding:8px 0;border-bottom:1px solid rgba(0,245,255,.05);align-items:flex-start}
.sidebar-item:last-child{border-bottom:none}
.sidebar-item-title{font-size:.8rem;font-weight:600;color:var(--text);line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.sidebar-item-date{font-size:.68rem;color:var(--text3);margin-top:3px}
.sidebar-thumb{width:52px;height:52px;border-radius:6px;overflow:hidden;flex-shrink:0;background:var(--surface2)}
.sidebar-thumb img{width:100%;height:100%;object-fit:cover}
.posts-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:20px}
@media(max-width:900px){
  .blog-grid{grid-template-columns:1fr}
  .blog-sidebar{display:none}
}
@media(max-width:480px){
  .posts-grid{grid-template-columns:1fr}
}
</style>
@endpush

@section('content')
<div class="blog-hero">
  <div style="max-width:1200px;margin:0 auto">
    <h1><i class="bi bi-journal-richtext" style="color:var(--accent2);font-size:1.2rem;margin-right:10px"></i>Anime Blog</h1>
    <p>AI destekli anime rehberleri, izleme önerileri ve derinlemesine incelemeler.</p>
  </div>
</div>

<div class="section">
  <div class="blog-grid">
    <div>
      @if($posts->count())
      <div class="posts-grid">
        @foreach($posts as $post)
        <a href="{{ route('blog.show', $post->slug) }}" class="blog-card" style="text-decoration:none">
          <div class="blog-thumb">
            @if($post->coverUrl)
            <img src="{{ $post->coverUrl }}" alt="{{ $post->title }}" loading="lazy">
            @else
            <div class="blog-thumb-ph"><i class="bi bi-journal-richtext"></i></div>
            @endif
          </div>
          <div class="blog-body">
            @if($post->ai_generated)
            <div class="blog-ai-badge"><i class="bi bi-stars" style="font-size:.6rem"></i> AI İçerik</div>
            @endif
            @if($post->anime)
            <div class="blog-category">{{ $post->anime->title }}</div>
            @endif
            <div class="blog-title">{{ $post->title }}</div>
            <div class="blog-excerpt">{{ $post->excerpt }}</div>
            <div class="blog-footer">
              <span class="blog-date">{{ $post->published_at?->format('d.m.Y') }}</span>
              <span class="blog-read"><i class="bi bi-clock" style="font-size:.65rem"></i> {{ $post->reading_time }} dk</span>
            </div>
          </div>
        </a>
        @endforeach
      </div>

      @if($posts->hasPages())
      <div style="margin-top:32px">{{ $posts->links('frontend.pagination') }}</div>
      @endif
      @else
      <div style="text-align:center;padding:80px 20px;color:var(--text3)">
        <i class="bi bi-journal-text" style="font-size:3rem;opacity:.25;display:block;margin-bottom:14px"></i>
        <p>Henüz blog yazısı yok. Yakında yapay zeka destekli içerikler gelecek!</p>
      </div>
      @endif
    </div>

    <aside class="blog-sidebar">
      {{-- Son Yazılar --}}
      @if($recent->count())
      <div class="sidebar-card">
        <div class="sidebar-title">Son Yazılar</div>
        @foreach($recent as $p)
        <a href="{{ route('blog.show', $p->slug) }}" class="sidebar-item" style="text-decoration:none">
          <div class="sidebar-thumb">
            @if($p->coverUrl)<img src="{{ $p->coverUrl }}" alt="" loading="lazy">
            @else<div style="width:100%;height:100%;display:flex;align-items:center;justify-content:center;color:var(--text3)"><i class="bi bi-journal-text"></i></div>@endif
          </div>
          <div>
            <div class="sidebar-item-title">{{ $p->title }}</div>
            <div class="sidebar-item-date">{{ $p->published_at?->format('d.m.Y') }}</div>
          </div>
        </a>
        @endforeach
      </div>
      @endif

      {{-- En Çok Okunanlar --}}
      @if($popular->count())
      <div class="sidebar-card">
        <div class="sidebar-title"><i class="bi bi-fire" style="color:var(--accent)"></i> En Çok Okunanlar</div>
        @foreach($popular as $p)
        <a href="{{ route('blog.show', $p->slug) }}" class="sidebar-item" style="text-decoration:none">
          <div class="sidebar-thumb">
            @if($p->coverUrl)<img src="{{ $p->coverUrl }}" alt="" loading="lazy">
            @else<div style="width:100%;height:100%;display:flex;align-items:center;justify-content:center;color:var(--text3)"><i class="bi bi-journal-text"></i></div>@endif
          </div>
          <div>
            <div class="sidebar-item-title">{{ $p->title }}</div>
            <div class="sidebar-item-date">{{ number_format($p->views) }} görüntülenme</div>
          </div>
        </a>
        @endforeach
      </div>
      @endif
    </aside>
  </div>
</div>
@endsection
