@extends('layouts.app')

@section('content')
<div class="min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 py-8 px-4 md:px-8">
    <div class="max-w-7xl mx-auto">
        <!-- الرأس -->
        <div class="mb-8">
            <div class="flex items-center justify-between mb-6">
                <div>
                    <h1 class="text-3xl font-bold text-gray-900 mb-2">@transDb('View Zakat & Taxes')</h1>
                    <p class="text-gray-600">@transDb('Overview of your company\'s zakat and tax status')</p>
                </div>
                <div class="flex space-x-4 space-x-reverse">
                    <a href="{{ route('zakat-taxes.manage') }}" class="inline-flex items-center px-6 py-3 bg-white text-gray-700 font-semibold rounded-lg border border-gray-200 hover:bg-gray-50 transition-all duration-200 shadow-sm">
                        <i class="fas fa-cog ml-2 text-blue-600"></i>
                        <span>@transDb('Manage')</span>
                    </a>
                    <a href="{{ route('zakat-taxes.calculations') }}" class="inline-flex items-center px-6 py-3 bg-gradient-to-r from-blue-600 to-blue-700 text-white font-semibold rounded-lg hover:from-blue-700 hover:to-blue-800 transition-all duration-200 shadow-lg hover:shadow-xl transform hover:scale-105">
                        <i class="fas fa-plus ml-2"></i>
                        <span>@transDb('New Calculation')</span>
                    </a>
                </div>
            </div>
        </div>

        <!-- بطاقات الملخص -->
        <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
            <!-- ملخص الزكاة -->
            <div class="bg-white rounded-xl shadow-lg p-6 border border-gray-200">
                <div class="flex items-center justify-between mb-4">
                    <div class="p-3 bg-blue-50 rounded-lg">
                        <i class="fas fa-crescent-moon text-blue-600 text-2xl"></i>
                    </div>
                    <span class="text-sm font-medium text-gray-500">@transDb('Last Zakat Calculation')</span>
                </div>
                <div class="mb-4">
                    <h3 class="text-2xl font-bold text-gray-900">
                        {{ number_format($zakatSummary->zakat_amount ?? 0, 2) }} <span class="text-sm text-gray-500">@transDb('SAR')</span>
                    </h3>
                    <p class="text-sm text-gray-600">{{ $zakatSummary ? TranslationHelper::transFromDatabase('Calculated on') . ' ' . $zakatSummary->calculation_date->format('Y-m-d') : TranslationHelper::transFromDatabase('No calculations yet') }}</p>
                </div>
                <div class="flex items-center text-sm">
                    <span class="px-2 py-1 {{ ($zakatSummary->status ?? '') == 'paid' ? 'bg-green-100 text-green-700' : 'bg-amber-100 text-amber-700' }} rounded-full font-medium">
                        {{ TranslationHelper::transFromDatabase($zakatSummary->status ?? 'N/A') }}
                    </span>
                </div>
            </div>

            <!-- ملخص الضريبة الحالية -->
            <div class="bg-white rounded-xl shadow-lg p-6 border border-gray-200">
                <div class="flex items-center justify-between mb-4">
                    <div class="p-3 bg-green-50 rounded-lg">
                        <i class="fas fa-file-invoice-dollar text-green-600 text-2xl"></i>
                    </div>
                    <span class="text-sm font-medium text-gray-500">@transDb('Current Month VAT')</span>
                </div>
                <div class="mb-4">
                    <h3 class="text-2xl font-bold text-gray-900">
                        {{ number_format($currentVAT['net_vat'] ?? 0, 2) }} <span class="text-sm text-gray-500">@transDb('SAR')</span>
                    </h3>
                    <p class="text-sm text-gray-600">{{ TranslationHelper::transFromDatabase('From') . ' ' . Carbon\Carbon::now()->startOfMonth()->format('Y-m-d') }}</p>
                </div>
                <div class="grid grid-cols-2 gap-2 text-xs">
                    <div class="text-gray-600">{{ TranslationHelper::transFromDatabase('Sales VAT') }}: <span class="font-bold text-green-600">{{ number_format($currentVAT['vat_on_sales'] ?? 0, 2) }}</span></div>
                    <div class="text-gray-600">{{ TranslationHelper::transFromDatabase('Purchase VAT') }}: <span class="font-bold text-red-600">{{ number_format($currentVAT['vat_on_purchases'] ?? 0, 2) }}</span></div>
                </div>
            </div>

            <!-- آخر إقرار ضريبي -->
            <div class="bg-white rounded-xl shadow-lg p-6 border border-gray-200">
                <div class="flex items-center justify-between mb-4">
                    <div class="p-3 bg-purple-50 rounded-lg">
                        <i class="fas fa-clipboard-check text-purple-600 text-2xl"></i>
                    </div>
                    <span class="text-sm font-medium text-gray-500">@transDb('Latest Tax Declaration')</span>
                </div>
                <div class="mb-4">
                    <h3 class="text-2xl font-bold text-gray-900">
                        {{ $latestDeclaration ? number_format($latestDeclaration->net_vat_due, 2) : '0.00' }} <span class="text-sm text-gray-500">@transDb('SAR')</span>
                    </h3>
                    <p class="text-sm text-gray-600">{{ $latestDeclaration ? TranslationHelper::transFromDatabase('Period') . ': ' . $latestDeclaration->year . ' Q' . $latestDeclaration->period_number : TranslationHelper::transFromDatabase('No declarations submitted') }}</p>
                </div>
                <div class="flex items-center text-sm">
                    <span class="px-2 py-1 {{ ($latestDeclaration->status ?? '') == 'submitted' ? 'bg-blue-100 text-blue-700' : 'bg-gray-100 text-gray-700' }} rounded-full font-medium">
                        {{ TranslationHelper::transFromDatabase($latestDeclaration->status ?? 'N/A') }}
                    </span>
                </div>
            </div>
        </div>

        {{-- 
        <!-- الرسوم البيانية والجداول (يمكن إضافتها لاحقاً) -->
        <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
            <div class="bg-white rounded-xl shadow-lg p-8 border border-gray-200">
                <h3 class="text-xl font-bold text-gray-900 mb-6">@transDb('VAT Breakdown')</h3>
                <div class="h-64 flex items-center justify-center bg-gray-50 rounded-lg">
                    <p class="text-gray-500">@transDb('VAT Visualization Placeholder')</p>
                </div>
            </div>
            <div class="bg-white rounded-xl shadow-lg p-8 border border-gray-200">
                <h3 class="text-xl font-bold text-gray-900 mb-6">@transDb('Zakat History')</h3>
                <div class="h-64 flex items-center justify-center bg-gray-50 rounded-lg">
                    <p class="text-gray-500">@transDb('Zakat Trend Placeholder')</p>
                </div>
            </div>
        </div>
        --}}
    </div>
</div>
@endsection
