@extends('layouts.app')

@section('title', 'Scrim Matches')

@section('content')
<div class="container-fluid px-4 py-4" data-reveal>
    <div class="d-flex flex-column flex-md-row justify-content-between align-items-md-center gap-3 mb-4">
        <div>
            <h1 class="display-md mb-1" style="color: var(--arena-text-primary);">Scrim Lobby</h1>
            <p class="text-muted fs-sm mb-0">Organize practice matches, test tactics, and train against similar tiers.</p>
        </div>
        <div>
            <button class="btn-arena btn-primary btn-sm"><i class="bi bi-plus-lg"></i> Post Scrim Lobby</button>
        </div>
    </div>

    <!-- Scrims List -->
    <div class="row g-4">
        @foreach($scrims as $scrim)
        <div class="col-md-6">
            <div class="card-arena p-4 h-100 d-flex flex-column justify-content-between">
                <div>
                    <div class="d-flex justify-content-between align-items-start mb-3">
                        <div class="d-flex align-items-center gap-2">
                            <span class="badge-arena badge-accent">{{ $scrim['game_name'] }}</span>
                            <span class="badge-arena badge-muted" style="font-size: 0.65rem;">{{ $scrim['format'] }}</span>
                        </div>
                        <span class="fs-xs text-muted">Lobby Open</span>
                    </div>

                    <!-- Team Details -->
                    <div class="d-flex align-items-center gap-3 mb-4">
                        <div style="width: 44px; height: 44px; border-radius: var(--r-md); background: var(--arena-surface-03); display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--arena-accent); border: 1px solid var(--arena-border);">
                            {{ $scrim['team']['tag'] }}
                        </div>
                        <div>
                            <div class="fw-800 text-white fs-sm">{{ $scrim['team']['name'] }}</div>
                            <div class="fs-xs text-muted">Min Rank Required: <span class="text-white">{{ $scrim['min_rank'] }}</span></div>
                        </div>
                    </div>

                    <p class="fs-xs text-muted mb-4" style="line-height: 1.6;">
                        {{ $scrim['note'] ? $scrim['note'] : 'Looking for serious practice matches. Please submit applications containing current team roster info.' }}
                    </p>
                </div>

                <div class="mt-auto pt-3 border-top" style="border-color: var(--arena-border) !important;">
                    <div class="d-flex justify-content-between align-items-center mb-3 fs-xs text-muted">
                        <span>Lobby Server: <span class="text-white fw-600">{{ $scrim['server'] }}</span></span>
                        <span>Play Time: <span class="text-white fw-600">{{ \Carbon\Carbon::parse($scrim['scheduled_at'])->format('M d, H:i') }}</span></span>
                    </div>
                    <div class="d-flex gap-2">
                        <button class="btn-arena btn-secondary w-100 btn-sm">Message Leader</button>
                        <button class="btn-arena btn-primary w-100 btn-sm">Apply Match</button>
                    </div>
                </div>
            </div>
        </div>
        @endforeach
    </div>
</div>
@endsection
