@extends('layouts.admin')

@section('title', 'Create Coach')

@section('content')
<div class="dashboard-header" style="margin-bottom: 24px; display: flex; justify-content: space-between; align-items: center;">
    <div>
        <nav style="font-size:0.8rem; color:var(--text-muted); margin-bottom:4px;">
            <a href="{{ route('admin.coaches.index') }}" style="color:var(--text-muted); text-decoration:none;">Coaches</a>
            <span style="margin:0 6px;">/</span>
            <span style="color:var(--primary); font-weight:600;">Create</span>
        </nav>
        <h1 style="font-family:'Oswald',sans-serif; font-size:2rem; color:var(--primary); margin:0;">Add Coach</h1>
    </div>
    <a href="{{ route('admin.coaches.index') }}" class="btn btn-outline">
        <i class="fas fa-arrow-left"></i> Back
    </a>
</div>

<form method="POST" action="{{ route('admin.coaches.store') }}" enctype="multipart/form-data">
    @csrf
    <div class="admin-card">
        <div class="admin-card-header">
            <span class="admin-card-title"><i class="fas fa-dumbbell" style="color:var(--primary);margin-right:8px;"></i> Coach Details</span>
        </div>
        <div class="admin-card-body">
            <div style="display:grid; grid-template-columns:1fr 1fr; gap:20px;">
                <div class="form-group" style="margin-bottom:0;">
                    <label class="form-label">Full Name <span style="color:var(--secondary);">*</span></label>
                    <input type="text" name="name" class="form-control" value="{{ old('name') }}" required>
                </div>
                <div class="form-group" style="margin-bottom:0;">
                    <label class="form-label">Email</label>
                    <input type="email" name="email" class="form-control" value="{{ old('email') }}">
                </div>
                <div class="form-group" style="margin-bottom:0;">
                    <label class="form-label">Qualification <span style="color:var(--secondary);">*</span></label>
                    <input type="text" name="qualification" class="form-control" value="{{ old('qualification') }}" required placeholder="e.g. WTF Certified">
                </div>
                <div class="form-group" style="margin-bottom:0;">
                    <label class="form-label">Specialization</label>
                    <input type="text" name="specialization" class="form-control" value="{{ old('specialization') }}" placeholder="e.g. Poomsae, Kyorugi">
                </div>
                <div class="form-group" style="margin-bottom:0;">
                    <label class="form-label">Experience (years) <span style="color:var(--secondary);">*</span></label>
                    <input type="number" name="experience_years" class="form-control" value="{{ old('experience_years', 0) }}" min="0" required>
                </div>
                <div class="form-group" style="margin-bottom:0;">
                    <label class="form-label">Contact Phone</label>
                    <input type="text" name="contact_phone" class="form-control" value="{{ old('contact_phone') }}">
                </div>
                <div class="form-group" style="margin-bottom:0;">
                    <label class="form-label">Club</label>
                    <select name="club_id" class="form-control">
                        <option value="">None</option>
                        @foreach($clubs as $club)
                            <option value="{{ $club->id }}" {{ old('club_id') == $club->id ? 'selected' : '' }}>
                                {{ $club->name }} ({{ $club->district->name ?? '' }})
                            </option>
                        @endforeach
                    </select>
                </div>
                <div class="form-group" style="margin-bottom:0;">
                    <label class="form-label">Photo (optional)</label>
                    <input type="file" name="photo" class="form-control" accept="image/*">
                </div>
                <div class="form-group" style="grid-column:1 / -1; margin-bottom:0;">
                    <label class="form-label">Bio</label>
                    <textarea name="bio" class="form-control" rows="4" placeholder="Brief biography...">{{ old('bio') }}</textarea>
                </div>
            </div>

            <div style="display:flex; justify-content:flex-end; gap:8px; margin-top:24px; padding-top:20px; border-top:1px solid var(--border-color);">
                <a href="{{ route('admin.coaches.index') }}" class="btn btn-outline">Cancel</a>
                <button type="submit" class="btn btn-primary">Create Coach</button>
            </div>
        </div>
    </div>
</form>
@endsection
