@extends('admin.layouts.app')
@section('title', 'FAQs')
@section('content')
<div class="action-bar">
    <span>{{ $faqs->total() }} FAQs</span>
    <a href="{{ route('admin.faqs.create') }}" class="btn btn-primary">+ New FAQ</a>
</div>
<div class="card">
    <table>
        <tr><th>Question</th><th>Category</th><th>Order</th><th>Active</th><th>Actions</th></tr>
        @foreach($faqs as $faq)
        <tr>
            <td><strong>{{ \Illuminate\Support\Str::limit($faq->question, 60) }}</strong></td>
            <td>{{ $faq->category ?? '—' }}</td>
            <td>{{ $faq->order }}</td>
            <td>{!! $faq->is_active ? '<span style="color:#6fcf97">Yes</span>' : '<span style="color:#e74c3c">No</span>' !!}</td>
            <td class="inline-flex">
                <a href="{{ route('admin.faqs.edit', $faq) }}" class="btn btn-primary btn-sm">Edit</a>
                <form action="{{ route('admin.faqs.destroy', $faq) }}" method="POST" onsubmit="return confirm('Delete?')">
                    @csrf @method('DELETE')
                    <button type="submit" class="btn btn-danger btn-sm">Delete</button>
                </form>
            </td>
        </tr>
        @endforeach
    </table>
    <div class="pagination">{{ $faqs->links() }}</div>
</div>
@endsection
