{{--
    Partial: галерея фотографий + теги автомобиля (публичная страница авто)
    Переменные из родителя: $car, $carName, $photos, $fuelLabels, $countryFlags
--}}

{{-- Галерея --}}
<div class="gallery" style="margin-bottom:28px">
    <div class="gallery-main" id="gMain">
        @if(count($photos) > 0)
            <img src="{{ $photos[0] }}" alt="{{ $carName }}" id="mainImg"
                 style="width:100%;height:100%;object-fit:cover"/>
        @else
            <div style="width:100%;height:100%;background:var(--bg2);display:flex;align-items:center;justify-content:center;font-size:72px">🚗</div>
        @endif
    </div>
    @if(count($photos) > 1)
    <div class="gallery-thumbs" id="gThumbs">
        @foreach($photos as $i => $photo)
            <div class="thumb {{ $i === 0 ? 'active' : '' }}" onclick="setThumb({{ $i }}, '{{ $photo }}')">
                <img src="{{ $photo }}" alt="Фото {{ $i + 1 }}" loading="lazy"/>
            </div>
        @endforeach
    </div>
    @endif
</div>

{{-- Заголовок + теги --}}
<h1 style="font-family:var(--fh);font-size:clamp(24px,4vw,42px);font-weight:900;letter-spacing:-.02em;margin-bottom:12px">
    {{ $carName }}
</h1>

<div style="display:flex;gap:8px;flex-wrap:wrap;margin-bottom:28px">
    @if($car->country_origin)
        <span class="chip chip-dark">{{ $countryFlags[$car->country_origin] ?? '🌍' }} {{ $car->country_origin }}</span>
    @endif
    @if($car->condition === 'new')
        <span class="chip chip-red">Новый</span>
    @elseif($car->condition === 'used')
        <span class="chip chip-outline">С пробегом</span>
    @endif
    @if($car->engine_type)
        <span class="chip chip-outline">{{ $fuelLabels[$car->engine_type] ?? $car->engine_type }}</span>
    @endif
    @if($car->customs_cleared)
        <span class="chip chip-outline">Растаможен</span>
    @endif
    @if($car->accident_free)
        <span class="chip chip-outline">Без ДТП</span>
    @endif
</div>
