<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>@yield('title', 'Survey Kepuasan Masyarakat (SKM)')</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css">
    @stack('styles')
    <style>
        :root {
            --gov-red: #DC143C;
            --gov-blue: #1E3A8A;
            --gov-dark-blue: #1e40af;
        }
        .gov-header {
            background: linear-gradient(135deg, var(--gov-blue) 0%, var(--gov-dark-blue) 100%);
            border-bottom: 4px solid var(--gov-red);
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .gov-header .navbar-brand {
            font-weight: 700;
            font-size: 1.3rem;
            color: #fff !important;
        }
        .gov-header .nav-link {
            color: rgba(255,255,255,0.9) !important;
            font-weight: 500;
        }
        .gov-header .nav-link:hover {
            color: #fff !important;
        }
        .gov-header form {
            margin: 0;
        }
        .gov-header form button.nav-link {
            display: block;
            padding: 0.5rem 1rem;
            text-decoration: none;
            width: 100%;
            text-align: left;
        }
        .gov-header form button.nav-link:hover {
            color: #fff !important;
        }
        .gov-banner {
            background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
            border-bottom: 2px solid #dee2e6;
            padding: 15px 0;
        }
        .gov-banner h5 {
            color: var(--gov-blue);
            font-weight: 600;
            margin: 0;
        }
        .gov-footer {
            background: #2c3e50;
            color: #ecf0f1;
            padding: 30px 0 20px;
            margin-top: 50px;
        }
        .gov-footer h6 {
            color: #fff;
            font-weight: 600;
            margin-bottom: 15px;
        }
        .gov-footer a {
            color: #bdc3c7;
            text-decoration: none;
        }
        .gov-footer a:hover {
            color: #fff;
        }
        .card-gov {
            border: 1px solid #dee2e6;
            border-top: 4px solid var(--gov-blue);
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        }
        .card-gov .card-header {
            background: linear-gradient(135deg, var(--gov-blue) 0%, var(--gov-dark-blue) 100%);
            color: #fff;
            font-weight: 600;
            border: none;
        }
        .btn-gov-primary {
            background: var(--gov-blue);
            border-color: var(--gov-blue);
            color: #fff;
            font-weight: 500;
        }
        .btn-gov-primary:hover {
            background: var(--gov-dark-blue);
            border-color: var(--gov-dark-blue);
            color: #fff;
        }
        .badge-gov {
            background: var(--gov-red);
            color: #fff;
            padding: 6px 12px;
            font-weight: 600;
        }
        .gov-header .dropdown-menu {
            background: #fff;
            border: 1px solid rgba(0,0,0,.15);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        .gov-header .dropdown-item {
            color: #333;
            padding: 0.5rem 1.5rem;
        }
        .gov-header .dropdown-item:hover {
            background: var(--gov-blue);
            color: #fff;
        }
        .gov-header .dropdown-item i {
            width: 20px;
        }
    </style>
</head>
<body style="background-color: #f5f7fa;">
    <header class="gov-header">
        <nav class="navbar navbar-expand-lg">
            <div class="container">
                <a class="navbar-brand" href="{{ route('survei.form') }}">
                    <i class="bi bi-clipboard-check me-2"></i>
                    Survey Kepuasan Masyarakat (SKM)
                </a>
                <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" style="border-color: rgba(255,255,255,0.5);">
                    <span class="navbar-toggler-icon" style="background-image: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e\");"></span>
                </button>
                <div class="collapse navbar-collapse" id="navbarNav">
                    <ul class="navbar-nav ms-auto">
                        @auth
                            <li class="nav-item">
                                <a class="nav-link" href="{{ route('admin.survei.index') }}">
                                    <i class="bi bi-speedometer2 me-1"></i> Dashboard
                                </a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="{{ route('admin.opds.index') }}">
                                    <i class="bi bi-building me-1"></i> Kelola OPD
                                </a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="{{ route('admin.questions.index') }}">
                                    <i class="bi bi-question-circle me-1"></i> Konfigurasi Soal
                                </a>
                            </li>
                            <li class="nav-item dropdown">
                                <a class="nav-link dropdown-toggle" href="#" id="ppidDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                                    <i class="bi bi-folder-fill me-1"></i> PPID
                                </a>
                                <ul class="dropdown-menu" aria-labelledby="ppidDropdown">
                                    <li>
                                        <a class="dropdown-item" href="{{ route('admin.ppid.informasi.index') }}">
                                            <i class="bi bi-file-earmark-text me-2"></i> Kelola Informasi Publik
                                        </a>
                                    </li>
                                    <li>
                                        <a class="dropdown-item" href="{{ route('admin.ppid.permohonan.index') }}">
                                            <i class="bi bi-envelope me-2"></i> Kelola Permohonan
                                        </a>
                                    </li>
                                    <li><hr class="dropdown-divider"></li>
                                    <li>
                                        <a class="dropdown-item" href="{{ route('ppid.dashboard') }}" target="_blank">
                                            <i class="bi bi-box-arrow-up-right me-2"></i> Lihat PPID Publik
                                        </a>
                                    </li>
                                </ul>
                            </li>
                            <li class="nav-item dropdown">
                                <a class="nav-link dropdown-toggle" href="#" id="ikkDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                                    <i class="bi bi-graph-up me-1"></i> IKK
                                </a>
                                <ul class="dropdown-menu" aria-labelledby="ikkDropdown">
                                    @if(auth()->user()->isAdmin())
                                    <li>
                                        <a class="dropdown-item" href="{{ route('admin.ikk.bank-soal.index') }}">
                                            <i class="bi bi-journal-text me-2"></i> Kelola Bank Soal
                                        </a>
                                    </li>
                                    <li>
                                        <a class="dropdown-item" href="{{ route('admin.users.index') }}">
                                            <i class="bi bi-people me-2"></i> Kelola User
                                        </a>
                                    </li>
                                    <li><hr class="dropdown-divider"></li>
                                    @endif
                                    @if(auth()->user()->canVerify())
                                    <li>
                                        <a class="dropdown-item" href="{{ route('ikk.verifikasi.index') }}">
                                            <i class="bi bi-check-circle me-2"></i> Verifikasi Lembar Jawab
                                        </a>
                                    </li>
                                    <li>
                                        <a class="dropdown-item" href="{{ route('ikk.lembar-jawab.grafik') }}">
                                            <i class="bi bi-bar-chart me-2"></i> Grafik & Rekap
                                        </a>
                                    </li>
                                    <li><hr class="dropdown-divider"></li>
                                    @endif
                                    @if(auth()->user()->isOpd())
                                    <li>
                                        <a class="dropdown-item" href="{{ route('ikk.lembar-jawab.index') }}">
                                            <i class="bi bi-clipboard-data me-2"></i> Lembar Jawab Saya
                                        </a>
                                    </li>
                                    <li>
                                        <a class="dropdown-item" href="{{ route('ikk.lembar-jawab.create') }}">
                                            <i class="bi bi-plus-circle me-2"></i> Isi Lembar Jawab
                                        </a>
                                    </li>
                                    <li><hr class="dropdown-divider"></li>
                                    @endif
                                    <li>
                                        <a class="dropdown-item" href="{{ route('sikk.bank-soal.index') }}" target="_blank">
                                            <i class="bi bi-box-arrow-up-right me-2"></i> Lihat Bank Soal Publik
                                        </a>
                                    </li>
                                </ul>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="#" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
                                    <i class="bi bi-box-arrow-right me-1"></i> Keluar
                                </a>
                                <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                    @csrf
                                </form>
                            </li>
                        @else
                            <li class="nav-item">
                                <a class="nav-link" href="{{ route('login') }}">
                                    <i class="bi bi-box-arrow-in-right me-1"></i> Login Admin
                                </a>
                            </li>
                        @endauth
                    </ul>
                </div>
            </div>
        </nav>
    </header>

    <div class="gov-banner">
        <div class="container">
            <h5><i class="bi bi-info-circle me-2"></i>Sistem Informasi Survey Kepuasan Masyarakat</h5>
        </div>
    </div>

    <main class="py-4" style="min-height: calc(100vh - 300px);">
        <div class="container">
            @if(session('success'))
                <div class="alert alert-success alert-dismissible fade show shadow-sm" role="alert">
                    <i class="bi bi-check-circle me-2"></i>
                    <strong>Berhasil!</strong> {{ session('success') }}
                    <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                </div>
            @endif

            @if(isset($errors) && $errors->any())
                <div class="alert alert-danger alert-dismissible fade show shadow-sm" role="alert">
                    <i class="bi bi-exclamation-triangle me-2"></i>
                    <strong>Terjadi Kesalahan!</strong>
                    <ul class="mb-0 mt-2">
                        @foreach($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                    <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                </div>
            @endif
        </div>

        @yield('content')
    </main>

    <footer class="gov-footer">
        <div class="container">
            <div class="row">
                <div class="col-md-6 mb-3">
                    <h6><i class="bi bi-building me-2"></i>Survey Kepuasan Masyarakat (SKM)</h6>
                    <p class="mb-2" style="color: #bdc3c7; font-size: 0.9rem;">
                        Sistem Informasi untuk mengukur tingkat kepuasan masyarakat terhadap pelayanan publik.
                    </p>
                </div>
                <div class="col-md-6 mb-3">
                    <h6><i class="bi bi-info-circle me-2"></i>Informasi</h6>
                    <p class="mb-2" style="color: #bdc3c7; font-size: 0.9rem;">
                        Survey ini menggunakan 9 (sembilan) elemen standar Survey Kepuasan Masyarakat sesuai dengan Peraturan Menteri Pendayagunaan Aparatur Negara dan Reformasi Birokrasi.
                    </p>
                </div>
            </div>
            <hr style="border-color: #34495e; margin: 20px 0;">
            <div class="text-center" style="color: #95a5a6; font-size: 0.85rem;">
                <p class="mb-0">
                    &copy; {{ date('Y') }} Survey Kepuasan Masyarakat (SKM). Hak Cipta Dilindungi.
                </p>
                <p class="mb-0 mt-1">
                    Dibangun dengan <i class="bi bi-heart-fill text-danger"></i> untuk Pelayanan Publik yang Lebih Baik
                </p>
            </div>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    @stack('scripts')
</body>
</html>

