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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>SSO Admin</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css" rel="stylesheet">
    <style>
        :root {
            --bs-table-bg: transparent;
            --bs-table-color: var(--text-main);
            --bs-table-border-color: var(--border-soft);
            --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
            --bs-border-color: var(--border-soft);
            --bg-body: #0b1021;
            --bg-panel: #0f172a;
            --bg-surface: #11182d;
            --bg-card: #121c34;
            --border-soft: rgba(255, 255, 255, 0.06);
            --text-main: #e2e8f0;
            --text-muted: #94a3b8;
            --accent: #3b82f6;
            --accent-2: #22d3ee;
            --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .theme-light {
            /* ... existing variables ... */
            --bg-body: #f3f4f6;
            --bg-panel: #ffffff;
            --bg-surface: #f8fafc;
            --bg-card: #ffffff;
            --border-soft: rgba(15, 23, 42, 0.08);
            --text-main: #0f172a;
            --text-muted: #475569;
            --accent: #2563eb;
            --accent-2: #0ea5e9;
        }

        body {
            background: radial-gradient(circle at 20% 20%, #0f1b3a, #0b1021 45%, #05070d 90%);
            color: var(--text-main);
            min-height: 100vh;
            overflow-x: hidden;
        }

        body.theme-light {
            background: var(--bg-body);
        }

        .sidebar {
            width: 260px;
            background: var(--bg-panel);
            color: var(--text-main);
            box-shadow: 0 0 24px rgba(0, 0, 0, 0.25);
            display: flex;
            flex-direction: column;
            border-right: 1px solid var(--border-soft);
        }

        .offcanvas.sidebar {
            width: 280px;
            background: var(--bg-panel) !important;
            border-right: 1px solid var(--border-soft);
        }

        .sidebar .nav-link {
            padding: 0.75rem 1rem;
            color: var(--text-muted);
            border-radius: 10px;
            transition: var(--transition);
            display: flex;
            align-items: center;
        }

        .sidebar .nav-link i {
            font-size: 1.1rem;
            width: 1.5rem;
        }

        .sidebar .nav-link:hover {
            color: var(--text-main);
            background: rgba(255, 255, 255, 0.05);
        }

        .sidebar .nav-link.active {
            background: linear-gradient(90deg, var(--accent), var(--accent-2));
            color: #fff !important;
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
        }

        .card-glass {
            background: var(--bg-card);
            border: 1px solid var(--border-soft);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
            border-radius: 16px;
            color: var(--text-main);
            backdrop-filter: blur(8px);
        }

        /* Improved Table Stripes */
        .table tbody tr:nth-child(even) {
            background-color: rgba(255, 255, 255, 0.05) !important;
        }

        .table tbody tr:nth-child(odd) {
            background-color: rgba(255, 255, 255, 0.02) !important;
        }

        .table tbody tr:hover {
            background-color: rgba(255, 255, 255, 0.08) !important;
        }

        /* Pagination Theming */
        .pagination .page-link {
            background: rgba(255, 255, 255, 0.03);
            border-color: var(--border-soft);
            color: var(--text-main);
            transition: var(--transition);
        }

        .pagination .page-link:hover {
            background: rgba(255, 255, 255, 0.1);
            color: var(--accent-2);
            border-color: var(--accent);
        }

        .pagination .page-item.active .page-link {
            background: linear-gradient(90deg, var(--accent), var(--accent-2));
            border-color: transparent;
        }

        .pagination .page-item.disabled .page-link {
            background: transparent;
            color: var(--text-muted);
            opacity: 0.5;
        }

        .form-control, .form-select {
            background-color: var(--bg-surface);
            color: var(--text-main);
            border: 1px solid var(--border-soft);
            border-radius: 8px;
        }

        .form-control:focus,
        .form-select:focus {
            box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
        }

        .btn-primary {
            background: linear-gradient(90deg, var(--accent), var(--accent-2));
            border: 0;
        }

        .btn-outline-secondary {
            color: var(--text-main);
            border-color: var(--border-soft);
        }

        .badge-soft {
            background: rgba(255, 255, 255, 0.1);
            color: var(--text-main);
            border: 1px solid var(--border-soft);
        }

        .gradient-title {
            background: linear-gradient(90deg, var(--accent), var(--accent-2));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .toast {
            background: var(--bg-card);
            color: var(--text-main);
            border: 1px solid var(--border-soft);
            backdrop-filter: blur(10px);
        }

        .modal-content {
            background: var(--bg-card);
            color: var(--text-main);
            border: 1px solid var(--border-soft);
            border-radius: 20px;
            backdrop-filter: blur(15px);
        }

        .table {
            --bs-table-bg: transparent;
            --bs-table-color: var(--text-main);
            --bs-table-border-color: var(--border-soft);
        }

        .table td, .table th {
            padding: 1rem 0.75rem;
            border-color: var(--border-soft);
        }

        .text-muted {
            color: var(--text-muted) !important;
        }

        /* Scrollbar Styling */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

        ::-webkit-scrollbar-track {
            background: var(--bg-card);
        }

        ::-webkit-scrollbar-thumb {
            background: var(--border-soft);
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--text-muted);
        }
    </style>
</head>

<body class="theme-{{ session('theme', 'system') }}">
    <!-- Mobile Header -->
    <nav class="navbar d-lg-none px-3 py-2 sticky-top" style="background: var(--bg-panel) !important; border-bottom: 1px solid var(--border-soft);">
        <div class="fw-bold gradient-title">SSO ADMIN</div>
        <button class="btn btn-outline-secondary btn-sm border-0" type="button" data-bs-toggle="offcanvas" data-bs-target="#sidebarOffcanvas">
            <i class="bi bi-list fs-4"></i>
        </button>
    </nav>

    <div class="d-flex">
        <!-- Desktop Sidebar -->
        <aside class="sidebar d-none d-lg-flex p-3 sticky-top" style="height: 100vh;">
            @include('layouts.sidebar-content')
        </aside>

        <!-- Mobile Sidebar (Offcanvas) -->
        <div class="offcanvas offcanvas-start sidebar d-lg-none" tabindex="-1" id="sidebarOffcanvas">
            <div class="offcanvas-header border-bottom border-white border-opacity-10">
                <h5 class="offcanvas-title fw-bold gradient-title">SSO ADMIN</h5>
                <button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas"></button>
            </div>
            <div class="offcanvas-body p-3 d-flex flex-column">
                @include('layouts.sidebar-content')
            </div>
        </div>

        <main class="flex-grow-1 p-3 p-md-4" style="min-width: 0;">
            @if (session('status'))
                <div class="toast align-items-center text-bg-success border-0 show mb-3" role="alert">
                    <div class="d-flex">
                        <div class="toast-body">
                            {{ session('status') }}
                        </div>
                        <button type="button" class="btn-close btn-close-white me-2 m-auto"
                            data-bs-dismiss="toast"></button>
                    </div>
                </div>
            @endif
            @if ($errors->any())
                <div class="alert alert-danger card-glass">
                    <ul class="mb-0">
                        @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            @endif
            @yield('content')
        </main>
    </div>

    <!-- Global confirm modal -->
    <div class="modal fade" id="confirmModal" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><i class="bi bi-exclamation-triangle-fill text-warning me-2"></i>Konfirmasi
                    </h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <p class="mb-0" id="confirmMessage">Anda yakin?</p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Batal</button>
                    <a href="#" class="btn btn-danger" id="confirmAction">Lanjutkan</a>
                </div>
            </div>
        </div>
    </div>
    </div>



    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // Auto-show and hide toasts
        document.addEventListener('DOMContentLoaded', () => {
            document.querySelectorAll('.toast').forEach((toastEl) => {
                const t = new bootstrap.Toast(toastEl, { delay: 4000 });
                t.show();
            });

            // Modal confirm handler
            const confirmModal = document.getElementById('confirmModal');
            const confirmMessage = document.getElementById('confirmMessage');
            const confirmAction = document.getElementById('confirmAction');
            document.querySelectorAll('[data-confirm-modal]').forEach((el) => {
                el.addEventListener('click', (e) => {
                    e.preventDefault();
                    const msg = el.getAttribute('data-confirm-modal') || 'Anda yakin?';
                    const href = el.getAttribute('href');
                    confirmMessage.textContent = msg;
                    confirmAction.setAttribute('href', href || '#');
                    const modal = new bootstrap.Modal(confirmModal);
                    modal.show();
            });
 });  });
    </script>
    @yield('scripts')
</body>

</html>