@extends('layouts.app')
@section('title', 'Products — MUVR Labs')
@section('content')

<section class="page-hero-dark py-5 px-4 px-lg-5">
    <div class="container-fluid">
        <div class="row align-items-center">
            <div class="col-lg-8">
                <div class="hero-eyebrow mb-2">Our Portfolio</div>
                <h1 class="fw-800 text-white mb-2" style="font-size:1.6rem">Products</h1>
                <p style="font-size:.85rem;color:#94a3b8;line-height:1.65">Our current flagship systems developed for standards-oriented gas phase testing and performance evaluation.</p>
            </div>
        </div>
    </div>
</section>

<section class="py-5 px-4 px-lg-5">
    <div class="container-fluid">
        @foreach($products as $index => $product)
        <div id="product-{{ $product->id }}">
            <div class="sec-label mb-1">Product {{ $index + 1 }}</div>
            <div class="row align-items-start g-4 mb-5">
                <div class="col-lg-3">
                    <div class="d-flex align-items-center justify-content-center position-relative mb-3" style="background:#f1f5f9;border-radius:10px;height:160px;border:1px solid var(--border-light)">
                        @if($product->hero_image)
                        <img src="{{ asset('uploads/images/'.$product->hero_image) }}" alt="{{ $product->name }}" style="max-height:140px;max-width:90%;object-fit:contain">
                        @else
                        <div style="width:80px;height:100px;background:#dbeafe;border-radius:6px;border:1px solid #93c5fd"></div>
                        @endif
                    </div>
                    @if($product->images->count())
                    <div class="row g-2">
                        @foreach($product->images->take(3) as $img)
                        <div class="col-4">
                            <div style="height:50px;background:#e8f0fe;border-radius:5px;border:1px solid #dbeafe;overflow:hidden">
                                <img src="{{ asset('uploads/images/'.$img->image_path) }}" alt="" style="width:100%;height:100%;object-fit:cover">
                            </div>
                        </div>
                        @endforeach
                    </div>
                    @endif
                </div>
                <div class="col-lg-9">
                    <h2 class="fw-800 mb-2" style="font-size:1.3rem;color:var(--brand-dark)">{{ $product->name }}</h2>
                    @if($product->standard_badge)
                    <span class="product-standard-badge mb-3">{{ $product->standard_badge }} Compliant</span>
                    @endif
                    <p class="mb-3" style="font-size:.83rem;color:#475569;line-height:1.65">{{ $product->short_description }}</p>
                    @if($product->features->count())
                    <div class="row g-1 mb-4">
                        @foreach($product->features as $feature)
                        <div class="col-md-6">
                            <div class="feature-check" style="font-size:.8rem;color:#374151">{{ $feature->feature }}</div>
                        </div>
                        @endforeach
                    </div>
                    @endif
                    <div class="d-flex gap-2 flex-wrap">
                        <a href="{{ route('product.show', $product->slug) }}" class="btn btn-brand btn-sm px-3">Enquire About This Product</a>
                        @if($product->brochure_file)
                        <a href="{{ asset('uploads/brochures/'.$product->brochure_file) }}" class="btn btn-sm" style="border:1px solid #cbd5e1;color:#374151" download>Download Brochure</a>
                        @endif
                        <a href="{{ route('contact') }}?product={{ $product->id }}" class="btn btn-sm" style="border:1px solid #cbd5e1;color:#374151">Request Demo</a>
                    </div>
                </div>
            </div>
        </div>
        @if(!$loop->last)<hr class="divider-light my-5">@endif
        @endforeach
    </div>
</section>

<section class="final-cta py-5 text-center">
    <div class="container">
        <h3 class="text-white fw-800 mb-2" style="font-size:1.2rem">Interested in Our Products?</h3>
        <p class="text-secondary mb-4" style="font-size:.82rem">Get in touch with our team to discuss specifications, pricing, or to request a demonstration.</p>
        <div class="d-flex gap-3 justify-content-center flex-wrap">
            <a href="{{ route('contact') }}" class="btn btn-brand px-4">Send an Enquiry</a>
            <a href="{{ route('resources') }}" class="btn btn-outline-light-custom px-4">Download Brochures</a>
        </div>
    </div>
</section>
@endsection
