@extends('layouts.app')

@section('title', $surah->surah_name)

@section('content')
<div class="page-content">
    <div class="container-fluid">
        <!-- Page Title -->
        <div class="row">
            <div class="col-12">
                <div class="page-title-box d-sm-flex align-items-center justify-content-between">
                    <h4 class="mb-sm-0">{{ $surah->surah_name }} - {{ $surah->surah_name_translation }}</h4>
                    <div class="page-title-right">
                        <ol class="breadcrumb m-0">
                            <li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
                            <li class="breadcrumb-item"><a href="{{ route('quran.index') }}">Quran</a></li>
                            <li class="breadcrumb-item"><a href="{{ route('quran.surahs') }}">Surahs</a></li>
                            <li class="breadcrumb-item active">{{ $surah->surah_no }}</li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>

        <!-- Surah Info Card -->
        <div class="row mb-4">
            <div class="col-lg-12">
                <div class="card border-0 shadow-sm overflow-hidden" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);">
                    <div class="card-body text-white p-4">
                        <div class="row align-items-center">
                            <div class="col-md-8">
                                <div class="mb-3">
                                    <span class="badge bg-white bg-opacity-25 mb-2">Surah {{ $surah->surah_no }}</span>
                                    <h3 class="mb-2" style="font-size: 32px; direction: rtl; text-align: right; font-family: 'Amiri', 'Traditional Arabic', serif;">
                                        {{ $surah->surah_name_arabic }}
                                    </h3>
                                    <h5 class="mb-0">{{ $surah->surah_name }} - {{ $surah->surah_name_translation }}</h5>
                                </div>
                                <div class="d-flex gap-3 flex-wrap">
                                    <span class="badge bg-white bg-opacity-25">
                                        <i class="ri-map-pin-line me-1"></i>{{ $surah->revelation_place }}
                                    </span>
                                    <span class="badge bg-white bg-opacity-25">
                                        <i class="ri-file-text-line me-1"></i>{{ $surah->total_ayah }} Ayats
                                    </span>
                                </div>
                            </div>
                            <div class="col-md-4 text-end">
                                <a href="{{ route('quran.surahs') }}" class="btn btn-light btn-sm">
                                    <i class="ri-arrow-left-line"></i> Back to Surahs
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Ayats -->
        <div class="row">
            <div class="col-lg-12">
                <div class="card border-0 shadow-sm">
                    <div class="card-header bg-transparent border-bottom">
                        <h5 class="card-title mb-0">
                            <i class="ri-file-text-line text-primary me-2"></i> Ayats (Verses)
                            <span class="badge bg-soft-primary text-primary ms-2">{{ $ayats->count() }}</span>
                        </h5>
                    </div>
                    <div class="card-body">
                        @foreach($ayats as $index => $ayat)
                        <div class="card border-0 shadow-sm mb-3 ayat-card" style="background: linear-gradient(to right, #f8f9fa 0%, #ffffff 100%);">
                            <div class="card-body p-4">
                                <div class="d-flex justify-content-between align-items-start mb-3">
                                    <div>
                                        <span class="badge bg-primary rounded-pill">Ayah {{ $ayat->ayah_no }}</span>
                                        @if($ayat->juz)
                                        <span class="badge bg-info rounded-pill ms-1">Juz {{ $ayat->juz }}</span>
                                        @endif
                                        @if($ayat->page)
                                        <span class="badge bg-secondary rounded-pill ms-1">Page {{ $ayat->page }}</span>
                                        @endif
                                    </div>
                                </div>
                                
                                <!-- Arabic Text -->
                                <div class="mb-3 p-3 rounded" style="background-color: #f8f9fa; border-right: 4px solid #667eea;">
                                    <div style="font-size: 22px; direction: rtl; text-align: right; font-family: 'Amiri', 'Traditional Arabic', serif; line-height: 2;">
                                        {{ $ayat->arabic_text }}
                                    </div>
                                </div>
                                
                                <!-- Transliteration -->
                                @if($ayat->transliteration)
                                <div class="mb-3 p-3 rounded bg-soft-warning">
                                    <div class="d-flex align-items-start">
                                        <i class="ri-translate-2-line text-warning me-2 mt-1"></i>
                                        <div>
                                            <small class="text-muted d-block mb-1">Transliteration</small>
                                            <div class="text-dark fst-italic">{{ $ayat->transliteration }}</div>
                                        </div>
                                    </div>
                                </div>
                                @endif
                                
                                <!-- Translation -->
                                <div class="p-3 rounded" style="background-color: #e7f3ff;">
                                    <div class="d-flex align-items-start">
                                        <i class="ri-translate-line text-primary me-2 mt-1"></i>
                                        <div>
                                            <small class="text-muted d-block mb-1">English Translation</small>
                                            <div class="text-dark">{{ $ayat->english_translation }}</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        @endforeach
                    </div>
                </div>
            </div>
        </div>

@push('styles')
<style>
    .ayat-card {
        transition: all 0.3s ease;
    }
    .ayat-card:hover {
        transform: translateX(5px);
        box-shadow: 0 5px 15px rgba(0,0,0,0.1) !important;
    }
    .bg-soft-warning {
        background-color: rgba(245, 158, 11, 0.1);
    }
</style>
@endpush
    </div>
</div>
@endsection

