@extends('front-end.layouts.apps')

@section('title', 'بلاګونه')

@section('page_title', 'بلاګونه')

@section('main_container')
<div class="container" dir="rtl">
    {{-- Back button and header --}}
    <div class="d-flex justify-content-between align-items-center mt-3 mb-4">
        <a href="{{ url()->previous() }}" class="btn-outline-secondary rounded-pill">
            <i class="fas fa-arrow-right ms-1"></i> شاته
        </a>
        <div class="section-header" style="margin-bottom: 0;">
            <i class="fas fa-blog"></i>
            <h3>بلاګونه</h3>
        </div>
    </div>

    {{-- Blog posts grid --}}
    <div class="row">
        @forelse ($blogs as $row)
            <div class="col-12 mb-4">
                <div class="blog-card">
                    <div class="row g-0 align-items-center">
                        <div class="col-md-4">
                            <div class="blog-image-wrapper">
                                <img src="{{ asset('storage/' . $row->image) }}" alt="{{ $row->title }}" class="blog-image">
                            </div>
                        </div>
                        <div class="col-md-8">
                            <div class="blog-content">
                                <h4 class="blog-title">{{ $row->title }}</h4>
                                <div class="blog-excerpt">
                                    {!! Str::limit($row->body, 300) !!}
                                </div>
                                <a href="{{ route('public.blog_details', $row->id) }}" class="btn-blog">
                                    <i class="fas fa-book-open me-1"></i> تفصیل
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        @empty
            <div class="col-12">
                <div class="alert alert-info text-center">
                    <i class="fas fa-info-circle"></i> تر اوسه بلاګونه نشته.
                </div>
            </div>
        @endforelse
    </div>

    {{-- Pagination --}}
    @if($blogs->hasPages())
        <div class="d-flex justify-content-center mt-4">
            {{ $blogs->links('pagination::bootstrap-4') }}
        </div>
    @endif

    {{-- Bottom Navigation --}}
    <nav class="bottom-nav">
        <a href="{{ url('/') }}" class="nav-item {{ request()->is('/') ? 'active' : '' }}">
            <i class="fas fa-home"></i> <span>کور</span>
        </a>
        <a href="{{ route('public.categories') }}" class="nav-item {{ request()->is('categories') || request()->is('categories*') ? 'active' : '' }}">
            <i class="fas fa-list-ul"></i> <span>کټګورۍ</span>
        </a>
        <a href="{{ route('public.poetry_search') }}" class="nav-item {{ request()->is('poetry/search') ? 'active' : '' }}">
            <i class="fas fa-search"></i> <span>لټون</span>
        </a>
    </nav>
</div>
@endsection

