<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@yield('title', 'پنل مربی') | آبتین اسپرت</title>
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <x-pwa-head />
    <link rel="stylesheet" href="{{ asset('css/app.css') }}">
</head>
<body class="bg-paper text-ink-900 antialiased">

<header class="bg-ink-950 text-slate-300">
    <div class="max-w-4xl mx-auto px-4 md:px-6">
        <div class="flex items-center justify-between h-14">
            <a href="{{ route('coach.dashboard') }}" class="flex items-center gap-2 text-white font-semibold text-sm">
                <span class="flex h-7 w-7 items-center justify-center rounded-lg bg-ember-500/15 text-ember-500">
                    <x-icon name="flame" class="w-4 h-4" />
                </span>
                آبتین اسپرت
            </a>
            <div class="flex items-center gap-3">
                <x-notification-bell />
                <span class="flex h-7 w-7 items-center justify-center rounded-full bg-ember-500 text-white text-xs font-semibold">
                    {{ mb_substr(auth()->user()->first_name, 0, 1) }}
                </span>
                <form method="POST" action="{{ route('logout') }}">
                    @csrf
                    <button type="submit" class="text-slate-400 hover:text-white transition-colors" title="خروج">
                        <x-icon name="logout" class="w-[18px] h-[18px]" />
                    </button>
                </form>
            </div>
        </div>
        <nav class="flex items-center gap-1 overflow-x-auto pb-2 -mb-px text-sm">
            <a href="{{ route('coach.requests.index') }}" class="nav-link !text-slate-400 whitespace-nowrap {{ request()->routeIs('coach.requests.*') ? '!text-white !bg-white/10' : '' }}">
                <x-icon name="clipboard" class="w-4 h-4" /> درخواست‌ها
            </a>
            <a href="{{ route('coach.athletes.index') }}" class="nav-link !text-slate-400 whitespace-nowrap {{ request()->routeIs('coach.athletes.*') ? '!text-white !bg-white/10' : '' }}">
                <x-icon name="users" class="w-4 h-4" /> ورزشکاران من
            </a>
            <a href="{{ route('coach.workout-plans.index') }}" class="nav-link !text-slate-400 whitespace-nowrap {{ request()->routeIs('coach.workout-plans.*') ? '!text-white !bg-white/10' : '' }}">
                <x-icon name="dumbbell" class="w-4 h-4" /> برنامه‌های تمرینی
            </a>
            <a href="{{ route('coach.nutrition-plans.index') }}" class="nav-link !text-slate-400 whitespace-nowrap {{ request()->routeIs('coach.nutrition-plans.*') ? '!text-white !bg-white/10' : '' }}">
                <x-icon name="meal" class="w-4 h-4" /> برنامه‌های غذایی
            </a>
            <a href="{{ route('coach.payments.index') }}" class="nav-link !text-slate-400 whitespace-nowrap {{ request()->routeIs('coach.payments.*') ? '!text-white !bg-white/10' : '' }}">
                <x-icon name="wallet" class="w-4 h-4" /> پرداخت‌ها
            </a>
            <a href="{{ route('coach.reviews.index') }}" class="nav-link !text-slate-400 whitespace-nowrap {{ request()->routeIs('coach.reviews.*') ? '!text-white !bg-white/10' : '' }}">
                <x-icon name="star" class="w-4 h-4" /> نظرات
            </a>
            <a href="{{ route('coach.profile.edit') }}" class="nav-link !text-slate-400 whitespace-nowrap {{ request()->routeIs('coach.profile.*') ? '!text-white !bg-white/10' : '' }}">
                <x-icon name="user" class="w-4 h-4" /> پروفایل
            </a>
            <a href="{{ route('coach.bank-account.edit') }}" class="nav-link !text-slate-400 whitespace-nowrap {{ request()->routeIs('coach.bank-account.*') ? '!text-white !bg-white/10' : '' }}">
                <x-icon name="card" class="w-4 h-4" /> اطلاعات بانکی
            </a>
        </nav>
    </div>
</header>

<main class="max-w-3xl mx-auto p-4 md:p-6">
    @if (session('status'))
        <div class="mb-5 flex items-center gap-2 rounded-xl bg-emerald-50 text-emerald-700 px-4 py-3 text-sm">
            <x-icon name="check" class="w-4 h-4 shrink-0" /> {{ session('status') }}
        </div>
    @endif
    @if ($errors->any())
        <div class="mb-5 rounded-xl bg-ember-50 text-ember-700 px-4 py-3 text-sm">
            <ul class="list-disc pr-4 space-y-0.5">
                @foreach ($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    @endif

    @yield('content')
</main>

<x-heartbeat-script />
<x-pwa-register-sw />
</body>
</html>
