@php
    use App\Models\Faq;

@endphp
@extends('layouts.main')

@section('content')
    <div class="container mt-5">
        <h1 class="mt-4 mb-4">FAQs</h1>
    <div class="row">
            @forelse($faqs as $faq)
            <div class="col-sm-8 offset-sm-2">
                <div class="m-3">
                    <div class="card text-center">
                        <div class="card-header">
                            <h5 class="card-title">{{ $faq->question }}</h5>
                        </div>
                        <div class="card-body">
                            <p class="card-text">{!! $faq->answer !!}</p>
                            @if($faq->link)
                                <a class="btn btn-primary" target="_blank" href="{{ $faq->link }}">{{ $faq->link_text }}</a>
                            @endif
                        </div>
                    </div>
                </div>
            </div>
                @empty
                <p class="text-center">No FAQs found</p>
            @endforelse
        </div>
    </div>
@endsection
