@extends('admin.layouts.app')

@section('title', $plan->name)

@section('content')
    <a href="{{ route('admin.workout-plans.index') }}" class="text-sm text-blue-600 hover:underline mb-4 inline-block">← بازگشت</a>

    <h1 class="text-xl font-bold mb-1">{{ $plan->name }}</h1>
    <p class="text-sm text-gray-500 mb-6">
        ورزشکار: {{ $plan->athlete->user->fullName() }} · مربی: {{ $plan->coach->user->fullName() }} · {{ $plan->status->label() }}
    </p>

    <div class="space-y-6">
        @foreach($plan->sessions as $session)
            <div class="bg-white rounded-xl shadow-sm p-4">
                <h2 class="font-semibold mb-3">{{ $session->title }}</h2>
                <div class="space-y-2">
                    @foreach($session->exercises as $ex)
                        <div class="border rounded-lg p-3 text-sm flex items-center gap-3">
                            @if($ex->exercise->gif_path)
                                <img src="{{ Storage::disk('public')->url($ex->exercise->gif_path) }}" class="w-12 h-12 rounded object-cover">
                            @endif
                            <div>
                                <span class="font-medium">{{ $ex->exercise->name }}</span>
                                <span class="text-gray-400"> — ست {{ $ex->sets ?? '—' }} × تکرار {{ $ex->reps ?? '—' }}</span>
                            </div>
                        </div>
                    @endforeach
                </div>
            </div>
        @endforeach
    </div>
@endsection
