<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>@yield('title', 'News Portal')</title>

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <style>
        body {
            background-color: #f8f9fa;
        }

        .news-card img {
            height: 200px;
            object-fit: cover;
        }

        footer {
            background: #212529;
            color: #fff;
        }

        .list-group-item a {
            color: #0d6efd;
        }

        .list-group-item a:hover {
            text-decoration: underline;
        }
    </style>
</head>

<body>

    <!-- Header -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="{{ route('news.index') }}">📰 News Portal</a>

            <div class="ms-auto">
                <form method="GET" action="{{ route('news.index') }}">
                    <select name="lang" class="form-select form-select-sm" onchange="this.form.submit()">
                        @foreach ($languages ?? [] as $language)
                            <option value="{{ $language['lang'] }}" {{ $lang == $language['lang'] ? 'selected' : '' }}>
                                {{ $language['name'] }}
                            </option>
                        @endforeach
                    </select>
                </form>

            </div>
        </div>
    </nav>


    <!-- Main Content -->
    <div class="container my-4">
        @yield('content')
    </div>

    <!-- Footer -->
    <footer class="py-3 mt-5">
        <div class="container text-center">
            <p class="mb-0">&copy; {{ date('Y') }} News Portal. All rights reserved.</p>
        </div>
    </footer>

    <!-- Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>

</html>
