<div class="card-arena p-4">
    <h2 class="text-white fs-5 mb-3">Add Video</h2>

    @if ($errors->any())
        <div class="alert alert-danger fs-sm">
            @foreach ($errors->all() as $error)
                <div>{{ $error }}</div>
            @endforeach
        </div>
    @endif

    <form method="POST" action="{{ route('profile.videos.store') }}">
        @csrf

        <div class="mb-3">
            <label class="form-label text-muted fs-sm">Title</label>
            <input type="text" name="title" class="form-control" value="{{ old('title') }}" required>
        </div>

        <div class="mb-3">
            <label class="form-label text-muted fs-sm">Video URL</label>
            <input type="url" name="original_url" class="form-control" value="{{ old('original_url') }}" placeholder="https://youtube.com/watch?v=..." required>
            <div class="form-text">YouTube, Twitch, or Vimeo links only. No embed HTML.</div>
        </div>

        <div class="mb-3">
            <label class="form-label text-muted fs-sm">Game Profile (optional)</label>
            <select name="player_game_profile_id" class="form-select">
                <option value="">None</option>
                @foreach($gameProfiles as $profile)
                    <option value="{{ $profile->id }}" @selected(old('player_game_profile_id') == $profile->id)>
                        {{ $profile->game->name }} — {{ $profile->in_game_name }}
                    </option>
                @endforeach
            </select>
        </div>

        <div class="mb-3">
            <label class="form-label text-muted fs-sm">Video Type</label>
            <select name="video_type" class="form-select" required>
                @foreach(\App\Enums\VideoType::cases() as $type)
                    <option value="{{ $type->value }}" @selected(old('video_type') === $type->value)>{{ $type->label() }}</option>
                @endforeach
            </select>
        </div>

        <div class="mb-3">
            <label class="form-label text-muted fs-sm">Description</label>
            <textarea name="description" class="form-control" rows="3">{{ old('description') }}</textarea>
        </div>

        <button type="submit" class="btn-arena btn-primary w-100">Save Video</button>
    </form>
</div>
