<!DOCTYPE html>
<html lang="en" class="light-style layout-menu-fixed" dir="ltr" data-theme="theme-default" data-assets-path="../assets/" data-template="vertical-menu-template-free">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
    <title>@yield('title') - AMetative HLE</title>
    <meta name="description" content="" />

    <!-- Favicon -->
    <link rel="icon" type="image/x-icon" href="{{ asset('backend/assets/img/logo/logo_ametative.png') }}" />

    <!-- Fonts -->
    <link rel="preconnect" href="https://fonts.googleapis.com" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link href="https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet" />

    <!-- Icons -->
    <link rel="stylesheet" href="{{ asset('backend/assets/vendor/fonts/boxicons.css') }}" />
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">

    <!-- Core CSS -->
    <link rel="stylesheet" href="{{ asset('backend/assets/vendor/css/core.css') }}" class="template-customizer-core-css" />
    <link rel="stylesheet" href="{{ asset('backend/assets/vendor/css/theme-default.css') }}" class="template-customizer-theme-css" />
    <link rel="stylesheet" href="{{ asset('backend/assets/css/demo.css') }}" />

    <!-- Vendors CSS -->
    <link rel="stylesheet" href="{{ asset('backend/assets/vendor/libs/perfect-scrollbar/perfect-scrollbar.css') }}" />
    <link rel="stylesheet" href="{{ asset('backend/assets/vendor/libs/apex-charts/apex-charts.css') }}" />

    <!-- Helpers -->
    <script src="{{ asset('backend/assets/vendor/js/helpers.js') }}"></script>
    <script src="{{ asset('backend/assets/js/config.js') }}"></script>
</head>
<body>
    <!-- Layout wrapper -->
    <div class="layout-wrapper layout-content-navbar">
        <div class="layout-container">
            <!-- Sidebar -->
            @include('main.partials.sidebar')

            <!-- Layout container -->
            <div class="layout-page">
                <!-- Navbar -->
                @include('main.partials.header')

                <!-- Content wrapper -->
                <div class="content-wrapper">
                    @yield('content')
                    <div class="content-backdrop fade"></div>
                </div>
            </div>
        </div>
        <!-- Overlay -->
        <div class="layout-overlay layout-menu-toggle"></div>
    </div>

    <!-- Bantuan Overlay -->
    <div id="helpOverlay" class="overlay" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000;">
        <div class="overlay-content d-flex align-items-center" style="position: absolute; bottom: 20px; right: 20px; background: white; padding: 20px; border-radius: 5px; max-width: 500px; width: 90%;">
            <div class="me-3">
                <h5>Yura</h5>
                <div id="helpInstructionsContent"></div>
                <div class="d-flex justify-content-between mt-3">
                    <button id="prevStep" class="btn btn-outline-secondary" style="visibility: hidden;">&lt;</button>
                    <span id="stepCounter"></span>
                    <button id="nextStep" class="btn btn-outline-secondary">&gt;</button>
                    <button id="skipTour" class="btn btn-outline-secondary">Tutup</button>
                </div>
            </div>
            <img src="https://raw.githubusercontent.com/Sangga123/asset/refs/heads/main/3f11c161-28c5-4cc7-be53-61f6e90d9230.jfif-removebg-preview%203.png" alt="Yura" style="width: 100px; height: auto;">
        </div>
    </div>

    <!-- Bantuan -->
    <div class="bantuan">
        <a href="#" id="helpButton" target="_blank">
            <img src="https://raw.githubusercontent.com/Sangga123/asset/refs/heads/main/3f11c161-28c5-4cc7-be53-61f6e90d9230.jfif-removebg-preview%203.png" alt="Pusat Bantuan" style="width: 100px; height: auto; position: fixed; bottom: 20px; right: 20px; z-index: 999; cursor: pointer;">
        </a>
    </div>

    <!-- Core JS -->
    <script src="{{ asset('backend/assets/vendor/libs/jquery/jquery.js') }}"></script>
    <script src="{{ asset('backend/assets/vendor/libs/popper/popper.js') }}"></script>
    <script src="{{ asset('backend/assets/vendor/js/bootstrap.js') }}"></script>
    <script src="{{ asset('backend/assets/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') }}"></script>
    <script src="{{ asset('backend/assets/vendor/js/menu.js') }}"></script>
    <script src="{{ asset('backend/assets/vendor/libs/apex-charts/apexcharts.js') }}"></script>
    <script src="{{ asset('backend/assets/js/main.js') }}"></script>
    <script src="{{ asset('backend/assets/js/dashboards-analytics.js') }}"></script>
    <script async defer src="https://buttons.github.io/buttons.js"></script>
    <script>
        let currentStep = 0;
        let instructions = [];

        document.getElementById('helpButton').addEventListener('click', function(e) {
            e.preventDefault();
            // Parse the instructions from the Blade section
            const rawInstructions = `@yield('helpInstruction', '[]')`;
            instructions = JSON.parse(rawInstructions);

            if (instructions.length > 0) {
                currentStep = 0;
                showStep(currentStep);
                document.getElementById('helpOverlay').style.display = 'block';
            }
        });

        document.getElementById('nextStep').addEventListener('click', function() {
            if (currentStep < instructions.length - 1) {
                currentStep++;
                showStep(currentStep);
            }
        });

        document.getElementById('prevStep').addEventListener('click', function() {
            if (currentStep > 0) {
                currentStep--;
                showStep(currentStep);
            }
        });

        document.getElementById('skipTour').addEventListener('click', function() {
            document.getElementById('helpOverlay').style.display = 'none';
        });

        window.addEventListener('click', function(event) {
            if (event.target === document.getElementById('helpOverlay')) {
                document.getElementById('helpOverlay').style.display = 'none';
            }
        });

        function showStep(step) {
            document.getElementById('helpInstructionsContent').innerHTML = instructions[step];
            document.getElementById('stepCounter').textContent = `${step + 1}/${instructions.length}`;
            document.getElementById('prevStep').style.visibility = step === 0 ? 'hidden' : 'visible';
            document.getElementById('nextStep').style.visibility = step === instructions.length - 1 ? 'hidden' : 'visible';
        }
    </script>
</body>
</html>