<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@yield('title', 'Admin - SIA Warkop Cak Imin')</title>
    <!-- AdminLTE CSS -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/admin-lte@3.2/dist/css/adminlte.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css">
    <!-- SweetAlert2 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
    <style>
        .main-sidebar { background-color: #2c3e50 !important; }
        .brand-link { background: linear-gradient(90deg, #ff8a00 0%, #ff5e00 100%) !important; color: white !important; border-bottom: none !important; }
        .nav-pills .nav-link.active, .nav-pills .show > .nav-link { background-color: #ff5e00 !important; color: #fff !important; }
        .sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active { background-color: #ff5e00 !important; }
        [class*="sidebar-dark-"] .nav-treeview > .nav-item > .nav-link.active { background-color: rgba(255, 94, 0, 0.2) !important; color: #ff5e00 !important; }

        @media (max-width: 992px) {
            .content-wrapper { padding: 0.75rem !important; }
            .container-fluid.px-4 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
            .page-header-custom, .card-custom, .card { border-radius: 12px; }
            .page-header-custom .d-flex, .page-header-custom > div { flex-wrap: wrap; }
            .page-header-custom .page-header-actions, .page-header-actions { width: 100%; justify-content: flex-start; gap: 0.75rem; margin-top: 0.75rem; }
            .page-header-actions .btn, .btn-add, .btn-secondary-white { width: 100%; min-width: auto; }
            .table-responsive { overflow-x: auto; }
            .table th, .table td { white-space: nowrap; }
            .table th { padding: 0.85rem 0.7rem; }
            .table td { padding: 0.85rem 0.7rem; }
            .btn-icon { width: 34px; height: 34px; }
            .card-header { padding: 14px 16px; }
        }

        @media (max-width: 768px) {
            .page-header-custom { padding: 18px 16px; }
            .main-header .navbar-nav .nav-item { margin-top: 0; }
            .main-header .navbar-nav .nav-link { padding: 0.5rem 0.75rem; }
            .brand-link { text-align: center; }
            .main-sidebar, .content-wrapper { overflow-x: hidden; }
            .table-responsive { margin-bottom: 1rem; }
        }
    </style>
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
    <!-- Navbar -->
    <nav class="main-header navbar navbar-expand navbar-white navbar-light">
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
            </li>
        </ul>
        <ul class="navbar-nav ml-auto">
            <li class="nav-item">
                <a href="#" class="nav-link" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
                    <i class="fas fa-sign-out-alt mr-2"></i> Logout
                </a>
                <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                    @csrf
                </form>
            </li>
        </ul>
    </nav>
    <!-- Sidebar -->
    <aside class="main-sidebar sidebar-dark-primary elevation-4">
        <a href="#" class="brand-link">
            <span class="brand-text font-weight-light">Admin - {{ auth()->user()->branch }}</span>
        </a>
        <div class="sidebar">
            <nav class="mt-2">
                <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu">
                    <li class="nav-item">
                        <a href="/admin/dashboard" class="nav-link {{ Request::is('admin/dashboard') ? 'active' : '' }}">
                            <i class="nav-icon fas fa-tachometer-alt"></i>
                            <p>Dashboard Owner</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="/produk" class="nav-link {{ Request::is('produk') || Request::is('bahan-baku') ? 'active' : '' }}">
                            <i class="nav-icon fas fa-utensils"></i>
                            <p>Produk & Bahan Baku</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="/manajemen-akun" class="nav-link {{ Request::is('manajemen-akun') ? 'active' : '' }}">
                            <i class="nav-icon fas fa-users-cog"></i>
                            <p>Manajemen Akun</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="/biaya-operasional" class="nav-link {{ Request::is('biaya-operasional') ? 'active' : '' }}">
                            <i class="nav-icon fas fa-wallet"></i>
                            <p>Biaya Operasional</p>
                        </a>
                    </li>

                    <li class="nav-item">
                        <a href="/laporan/pembelian" class="nav-link {{ Request::is('laporan/pembelian') ? 'active' : '' }}">
                            <i class="nav-icon fas fa-shopping-cart"></i>
                            <p>Laporan Pembelian</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="/laporan/penjualan" class="nav-link {{ Request::is('laporan/penjualan') ? 'active' : '' }}">
                            <i class="nav-icon fas fa-chart-line"></i>
                            <p>Laporan Penjualan</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="/laporan/neraca-laba-rugi" class="nav-link {{ Request::is('laporan/neraca-laba-rugi') ? 'active' : '' }}">
                            <i class="nav-icon fas fa-balance-scale"></i>
                            <p>Neraca Laba Rugi</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="/laporan/perubahan-modal" class="nav-link {{ Request::is('laporan/perubahan-modal') ? 'active' : '' }}">
                            <i class="nav-icon fas fa-chart-line"></i>
                            <p>Perubahan Modal</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="/laporan/neraca-keuangan" class="nav-link {{ Request::is('laporan/neraca-keuangan') ? 'active' : '' }}">
                            <i class="nav-icon fas fa-balance-scale-left"></i>
                            <p>Neraca Keuangan</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="/laporan/arus-kas" class="nav-link {{ Request::is('laporan/arus-kas') ? 'active' : '' }}">
                            <i class="nav-icon fas fa-water"></i>
                            <p>Laporan Arus Kas</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="/laporan/buku-besar" class="nav-link {{ Request::is('laporan/buku-besar') ? 'active' : '' }}">
                            <i class="nav-icon fas fa-book"></i>
                            <p>Buku Besar</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="/laporan/jurnal-umum" class="nav-link {{ Request::is('laporan/jurnal-umum') ? 'active' : '' }}">
                            <i class="nav-icon fas fa-book-open"></i>
                            <p>Jurnal Umum</p>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
    </aside>
    <!-- Content Wrapper -->
    <div class="content-wrapper">
        @yield('content')
    </div>
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/admin-lte@3.2/dist/js/adminlte.min.js"></script>
<!-- SweetAlert2 -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
@stack('scripts')
</body>
</html>
