@extends('layouts.app')
@section('title', 'Gaji Saya')
@section('content')

<div class="max-w-3xl mx-auto" style="font-family: 'Plus Jakarta Sans', sans-serif;">

    <div class="mb-8">
        <h1 class="text-3xl font-black text-slate-800 italic tracking-tight">Gaji Saya 💸</h1>
        <p class="text-pink-400 font-bold text-sm mt-1">Riwayat penghasilan kamu</p>
    </div>

    @if($salaries->isEmpty())
        <div class="bg-white rounded-[32px] border-2 border-dashed border-pink-100 py-20 text-center">
            <p class="text-5xl mb-4">🙈</p>
            <p class="text-slate-400 font-black italic">Belum ada riwayat gaji.</p>
            <p class="text-slate-300 text-sm mt-1">Selesaikan pengiriman untuk mulai dapat gaji!</p>
        </div>
    @else
        <div class="space-y-4">
            @foreach($salaries as $s)
            <div class="bg-white rounded-[28px] border border-pink-50 shadow-sm p-6">
                <div class="flex flex-wrap items-center justify-between gap-4">

                    {{-- Periode --}}
                    <div>
                        <p class="font-black text-slate-800 text-lg">{{ $s->month_name }} {{ $s->year }}</p>
                        <p class="text-xs text-slate-400 font-bold mt-0.5">{{ $s->total_deliveries }} pengiriman selesai</p>
                    </div>

                    {{-- Rincian --}}
                    <div class="flex flex-wrap gap-5 text-center">
                        <div>
                            <p class="text-[10px] font-black text-slate-400 uppercase tracking-widest">Gaji Pokok</p>
                            <p class="font-black text-slate-700">Rp {{ number_format($s->base_salary, 0, ',', '.') }}</p>
                        </div>
                        <div>
                            <p class="text-[10px] font-black text-slate-400 uppercase tracking-widest">Bonus</p>
                            <p class="font-black text-pink-500">+ Rp {{ number_format($s->bonus, 0, ',', '.') }}</p>
                        </div>
                        <div>
                            <p class="text-[10px] font-black text-slate-400 uppercase tracking-widest">Total</p>
                            <p class="font-black text-emerald-600 text-lg">Rp {{ number_format($s->total_salary, 0, ',', '.') }}</p>
                        </div>
                    </div>

                    {{-- Status --}}
                    @if($s->status === 'paid')
                        <div class="text-right">
                            <span class="px-4 py-1.5 bg-emerald-100 text-emerald-600 text-[10px] font-black uppercase tracking-widest rounded-full">✅ Dibayar</span>
                            <p class="text-[10px] text-slate-400 mt-1">{{ $s->paid_at->format('d M Y') }}</p>
                        </div>
                    @else
                        <span class="px-4 py-1.5 bg-amber-100 text-amber-600 text-[10px] font-black uppercase tracking-widest rounded-full">⏳ Menunggu</span>
                    @endif

                </div>
            </div>
            @endforeach
        </div>
    @endif

</div>

<script>lucide.createIcons();</script>
@endsection