<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <title>@yield('title')</title>

    <meta name="viewport" content="width=device-width, initial-scale=1">

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

    <!-- FONT -->
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap" rel="stylesheet">

    <!-- ICON -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" rel="stylesheet">

    <style>
        body {
            font-family: 'Inter', sans-serif;
            background-color: #f1f5f9;
        }

        /* SIDEBAR */
        .sidebar {
            width: 250px;
            min-height: 100vh;
            background: #ffffff;
            border-right: 1px solid #e5e7eb;
        }

        .sidebar h4 {
            font-weight: 600;
            color: #0f172a;
        }

        .nav-link {
            color: #64748b !important;
            border-radius: 10px;
            padding: 10px 14px;
            margin-bottom: 6px;
            transition: 0.3s;
            font-size: 14px;
        }

        .nav-link:hover {
            background: #f1f5f9;
            color: #0ea5e9 !important;
        }

        .nav-link.active {
            background: #0ea5e9 !important;
            color: white !important;
        }

        /* CONTENT */
        .content {
            background-color: #f1f5f9;
            min-height: 100vh;
            padding: 30px;
            width: 100%;
        }

        /* HEADER */
        .topbar {
            background: white;
            border-radius: 14px;
            padding: 15px 20px;
            margin-bottom: 20px;
            box-shadow: 0 4px 15px rgba(0,0,0,0.05);
        }

        .page-title {
            font-weight: 600;
            color: #0f172a;
            margin-bottom: 0;
        }

        .page-subtitle {
            font-size: 13px;
            color: #64748b;
        }

        /* CARD */
        .card {
            border: none;
            border-radius: 16px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.05);
        }

        /* HERO CARD (seperti contoh gambar) */
        .card-hero {
            background: linear-gradient(135deg, #38bdf8, #0ea5e9);
            color: white;
            border-radius: 20px;
            padding: 30px;
        }

        .card-hero h2 {
            font-weight: 600;
        }

        .card-hero p {
            opacity: 0.9;
        }

        /* TABLE */
        .table {
            background: white;
            border-radius: 12px;
            overflow: hidden;
        }

        /* BUTTON */
        .btn-primary {
            background: #0ea5e9;
            border: none;
        }

        .btn-primary:hover {
            background: #0284c7;
        }

    </style>
</head>
<body>

<div class="d-flex">

    <!-- SIDEBAR -->
    <div class="sidebar p-3">

        <h4 class="text-center mb-3">Admin Panel</h4>
        <hr>

        <ul class="nav flex-column">

            <li class="nav-item">
                <a href="{{ url('/admin/dashboard') }}" 
                   class="nav-link {{ request()->is('admin/dashboard') ? 'active' : '' }}">
                   <i class="fa fa-home me-2"></i> Dashboard
                </a>
            </li>

            <li class="nav-item">
                <a href="{{ url('/admin/pasien') }}" 
                   class="nav-link {{ request()->is('admin/pasien') ? 'active' : '' }}">
                   <i class="fa fa-user me-2"></i> Data Pasien
                </a>
            </li>

            <li class="nav-item">
                <a href="{{ url('/admin/gejala') }}" 
                   class="nav-link {{ request()->is('admin/gejala*') ? 'active' : '' }}">
                   <i class="fa fa-stethoscope me-2"></i> Data Gejala
                </a>
            </li>

            <li class="nav-item">
                <a href="{{ url('/admin/penyakit') }}" 
                   class="nav-link {{ request()->is('admin/penyakit*') ? 'active' : '' }}">
                   <i class="fa fa-virus me-2"></i> Data Penyakit
                </a>
            </li>

            <li class="nav-item">
                <a href="{{ url('/admin/rule') }}" 
                   class="nav-link {{ request()->is('admin/rule*') ? 'active' : '' }}">
                   <i class="fa fa-project-diagram me-2"></i> Rule CF
                </a>
            </li>

            <li class="nav-item">
                <a href="{{ url('/admin/edukasi') }}" 
                   class="nav-link {{ request()->is('admin/edukasi*') ? 'active' : '' }}">
                   <i class="fa fa-book me-2"></i> Data Edukasi
                </a>
            </li>

            <li class="nav-item">
                <a href="{{ url('/admin/riwayat') }}" 
                   class="nav-link {{ request()->is('admin/riwayat') ? 'active' : '' }}">
                   <i class="fa fa-history me-2"></i> Riwayat
                </a>
            </li>

            <!-- LOGOUT -->
            <li class="nav-item mt-4">
                <form action="{{ route('logout') }}" method="POST">
                    @csrf
                    <button type="submit" 
                        class="nav-link text-danger border-0 bg-transparent text-start w-100">
                        <i class="fa fa-sign-out-alt me-2"></i> Logout
                    </button>
                </form>
            </li>

        </ul>
    </div>

    <!-- CONTENT -->
    <div class="content">

        <!-- TOPBAR -->
        <div class="topbar d-flex justify-content-between align-items-center">
            <div>
                <h5 class="page-title">@yield('title')</h5>
                <div class="page-subtitle">
                    Sistem Pakar Diagnosa Penyakit Hipertensi
                </div>
            </div>

            <div>
                 {{ auth()->user()->name ?? 'Admin' }}
            </div>
        </div>

        <!-- HERO (OPSIONAL DI DASHBOARD) -->
        @if(request()->is('admin/dashboard'))
        <div class="card-hero mb-4">
            <h2>Selamat Datang</h2>
            <p>
                Sistem pakar membantu diagnosa penyakit berdasarkan gejala 
                dengan metode Certainty Factor
            </p>
        </div>
        @endif

        <!-- CONTENT UTAMA -->
        @yield('content')

    </div>

</div>

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

@stack('scripts')
@yield('scripts')

</body>
</html>