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

@section('title', ($poetries->title ?? 'د شعر تفصیلات') . ' | ' . ($category->name_ps ?? $category->name_en ?? 'ولسي ادب'))

@section('page_title', $poetries->title ?? 'د شعر تفصیلات')

@section('main_container')
<div class="container" dir="rtl">
    {{-- Back button and category badge --}}
    <div class="d-flex justify-content-between align-items-center mt-3 mb-4">
        {{-- <a href="{{ route('public.public_poetry_category', $category->id) }}" class="btn-outline-secondary rounded-pill">
            <i class="fas fa-arrow-right ms-1"></i> شاته
        </a> --}}
        @if($category)
            <span class="badge-custom">{{ $category->name_ps ?? $category->name_en }}</span>
        @endif
    </div>

    {{-- Poetry Card --}}
    <div class="poetry-card">
        <div class="poetry-header">
            <h1 class="poetry-title">{{ $poetries->title ?? 'بې نوم شعر' }}</h1>
        </div>

        <div class="poetry-content">
            {!! $poetries->body !!}
        </div>

        {{-- Action toolbar: copy and share --}}
        <div class="poetry-actions">
            <button class="action-btn copy-btn" onclick="copyPoetry()" title="کاپي کول">
                <i class="fas fa-copy"></i>
            </button>
            <a href="https://www.facebook.com/sharer/sharer.php?u={{ urlencode(request()->url()) }}" target="_blank" class="action-btn facebook" title="فیسبوک">
                <i class="fab fa-facebook-f"></i>
            </a>
            <a href="https://twitter.com/intent/tweet?text={{ urlencode($poetries->title . ' - ' . strip_tags($poetries->body)) }}" target="_blank" class="action-btn twitter" title="ټویټر">
                <i class="fab fa-twitter"></i>
            </a>
            <a href="https://www.linkedin.com/sharing/share-offsite/?url={{ urlencode(request()->url()) }}" target="_blank" class="action-btn linkedin" title="لینکډین">
                <i class="fab fa-linkedin-in"></i>
            </a>
            <a href="https://api.whatsapp.com/send?text={{ urlencode($poetries->title . ' - ' . strip_tags($poetries->body)) }}" target="_blank" class="action-btn whatsapp" title="واتساپ">
                <i class="fab fa-whatsapp"></i>
            </a>
            <a href="https://telegram.me/share/url?url={{ urlencode(request()->url()) }}&text={{ urlencode($poetries->title) }}" target="_blank" class="action-btn telegram" title="ټیلیګرام">
                <i class="fab fa-telegram-plane"></i>
            </a>
        </div>

        <div class="poetry-footer">
            <small class="text-muted">
                <i class="fas fa-calendar"></i>
                @if($poetries->created_at)
                    {{ $poetries->created_at->format('Y/m/d') }}
                @endif
            </small>
        </div>
    </div>

    {{-- 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

