@extends('layouts.app')

@section('title', 'My Videos')

@section('content')
<div class="container-fluid px-4 py-4">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h1 class="display-md text-white mb-0">My Videos</h1>
    </div>

    @if (session('status'))
        <div class="alert alert-success">{{ session('status') }}</div>
    @endif

    <div class="row g-4">
        <div class="col-lg-7">
            <div class="row g-3">
                @forelse($videos as $video)
                    <div class="col-md-6">
                        <div class="card-arena p-4 h-100">
                            <div class="d-flex justify-content-between align-items-start gap-2 mb-2">
                                <h3 class="text-white fs-6 mb-0">{{ $video->title }}</h3>
                                <span class="badge-arena badge-muted">{{ $video->moderation_status->label() }}</span>
                            </div>
                            <p class="text-muted fs-sm mb-1">{{ $video->provider->label() }} · {{ $video->video_type->label() }}</p>
                            <a href="{{ $video->normalized_url }}" target="_blank" rel="noopener" class="fs-xs" style="color:var(--arena-accent);">View link</a>
                            <form method="POST" action="{{ route('profile.videos.destroy', $video) }}" class="mt-3" onsubmit="return confirm('Delete this video?');">
                                @csrf
                                @method('DELETE')
                                <button type="submit" class="btn-arena btn-sm btn-outline-light">Delete</button>
                            </form>
                        </div>
                    </div>
                @empty
                    <div class="col-12">
                        <div class="card-arena p-4 text-muted">No videos yet. Add a YouTube, Twitch, or Vimeo link.</div>
                    </div>
                @endforelse
            </div>
            <div class="mt-3">{{ $videos->links() }}</div>
        </div>

        <div class="col-lg-5">
            @include('pages.profile.videos.form')
        </div>
    </div>
</div>
@endsection
