<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Dashboard | Otomotif PPLG</title>
    <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=Outfit:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --bg-color: #0b0c10;
            --card-bg: rgba(22, 26, 34, 0.65);
            --primary: #ef4444;
            --primary-light: #f87171;
            --primary-glow: rgba(239, 68, 68, 0.3);
            --text-main: #f3f4f6;
            --text-muted: #9ca3af;
            --border-color: rgba(239, 68, 68, 0.18);
            --font-family: 'Outfit', sans-serif;
            --success: #10b981;
            --danger: #ef4444;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: var(--font-family);
            background-color: var(--bg-color);
            background-image: 
                radial-gradient(circle at 10% 20%, rgba(255, 0, 0, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(255, 0, 0, 0.05) 0%, transparent 40%),
                linear-gradient(rgba(11, 12, 16, 0.95), rgba(11, 12, 16, 0.95)),
                repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.01) 0px, rgba(255, 255, 255, 0.01) 1px, transparent 1px, transparent 2px),
                repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.01) 0px, rgba(255, 255, 255, 0.01) 1px, transparent 1px, transparent 2px);
            background-size: 100% 100%, 100% 100%, 100% 100%, 20px 20px, 20px 20px;
            color: var(--text-main);
            min-height: 100vh;
            overflow-x: hidden;
            display: flex;
            flex-direction: column;
        }

        /* Navbar */
        .navbar {
            background: rgba(11, 12, 16, 0.85);
            backdrop-filter: blur(15px);
            -webkit-backdrop-filter: blur(15px);
            border-bottom: 1px solid var(--border-color);
            padding: 15px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .nav-brand {
            display: flex;
            align-items: center;
            gap: 10px;
            text-decoration: none;
            color: #ffffff;
        }

        .nav-brand i {
            font-size: 1.5rem;
            color: var(--primary-light);
            text-shadow: 0 0 10px var(--primary-glow);
        }

        .nav-brand span {
            font-weight: 800;
            font-size: 1.2rem;
            letter-spacing: 0.5px;
        }

        .nav-user {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .user-info {
            text-align: right;
        }

        .user-name {
            font-weight: 600;
            font-size: 0.9rem;
        }

        .user-role {
            font-size: 0.75rem;
            color: var(--primary-light);
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .btn-logout-nav {
            background: rgba(239, 68, 68, 0.1);
            border: 1px solid rgba(239, 68, 68, 0.2);
            color: #f87171;
            padding: 8px 12px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.85rem;
            font-weight: 600;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .btn-logout-nav:hover {
            background: var(--danger);
            color: #ffffff;
            transform: translateY(-1px);
        }

        /* Container */
        .container {
            max-width: 1200px;
            width: 100%;
            margin: 30px auto;
            padding: 0 20px;
            flex-grow: 1;
        }

        /* Welcome Header */
        .welcome-header {
            margin-bottom: 35px;
            animation: fadeIn 0.8s ease-out;
        }

        .welcome-header h1 {
            font-size: 2.2rem;
            font-weight: 800;
            background: linear-gradient(135deg, #ffffff 40%, var(--primary-light) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            margin-bottom: 5px;
        }

        .welcome-header p {
            color: var(--text-muted);
            font-size: 0.95rem;
        }

        /* Stats Grid */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 20px;
            margin-bottom: 35px;
        }

        .stat-card {
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 22px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 15px rgba(239, 68, 68, 0.03);
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: all 0.3s;
            position: relative;
            overflow: hidden;
        }

        .stat-card:hover {
            transform: translateY(-3px);
            border-color: var(--primary-light);
            box-shadow: 0 15px 40px rgba(239, 68, 68, 0.1);
        }

        .stat-card::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 3px;
            background: linear-gradient(90deg, transparent, var(--primary), transparent);
        }

        .stat-value {
            font-size: 2.2rem;
            font-weight: 800;
            color: #ffffff;
            line-height: 1.1;
        }

        .stat-label {
            font-size: 0.78rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--text-muted);
            margin-top: 5px;
            font-weight: 600;
        }

        .stat-icon {
            font-size: 2.2rem;
            color: rgba(239, 68, 68, 0.25);
            transition: color 0.3s;
        }

        .stat-card:hover .stat-icon {
            color: var(--primary-light);
        }

        /* Alerts */
        .alert {
            background: rgba(16, 185, 129, 0.1);
            border: 1px solid rgba(16, 185, 129, 0.3);
            color: #34d399;
            padding: 15px 20px;
            border-radius: 12px;
            margin-bottom: 25px;
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 0.9rem;
            animation: slideDown 0.4s ease-out;
        }

        .alert-danger {
            background: rgba(239, 68, 68, 0.1);
            border: 1px solid rgba(239, 68, 68, 0.3);
            color: #f87171;
        }

        /* Section Cards */
        .dashboard-grid {
            display: grid;
            grid-template-columns: 1.2fr 0.8fr;
            gap: 30px;
            margin-bottom: 40px;
        }

        @media (max-width: 992px) {
            .dashboard-grid {
                grid-template-columns: 1fr;
            }
        }

        .panel-card {
            background: var(--card-bg);
            backdrop-filter: blur(25px);
            -webkit-backdrop-filter: blur(25px);
            border: 1px solid var(--border-color);
            border-radius: 20px;
            padding: 30px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
            display: flex;
            flex-direction: column;
        }

        .panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
            flex-wrap: wrap;
            gap: 15px;
        }

        .panel-title {
            font-size: 1.25rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .panel-title i {
            color: var(--primary-light);
        }

        /* Activity Terminal Monitor */
        .terminal-container {
            background: rgba(8, 9, 12, 0.9);
            border: 1px solid rgba(255, 255, 255, 0.05);
            border-radius: 12px;
            font-family: monospace;
            padding: 15px;
            display: flex;
            flex-direction: column;
            height: 400px;
        }

        .terminal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
            padding-bottom: 10px;
            margin-bottom: 15px;
            font-size: 0.8rem;
            color: var(--primary-light);
        }

        .terminal-search {
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: #ffffff;
            border-radius: 6px;
            padding: 5px 10px;
            font-size: 0.75rem;
            outline: none;
            width: 180px;
        }

        .terminal-search:focus {
            border-color: var(--primary-light);
        }

        .terminal-body {
            flex-grow: 1;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 8px;
            padding-right: 5px;
        }

        .terminal-row {
            display: flex;
            font-size: 0.85rem;
            line-height: 1.4;
            border-bottom: 1px dashed rgba(255, 255, 255, 0.02);
            padding-bottom: 6px;
        }

        .terminal-time {
            color: var(--text-muted);
            min-width: 140px;
            font-size: 0.78rem;
        }

        .terminal-user {
            color: var(--primary-light);
            min-width: 110px;
            font-weight: 700;
        }

        .terminal-action {
            color: var(--text-main);
            flex-grow: 1;
        }

        .terminal-ip {
            color: #555;
            font-size: 0.75rem;
            margin-left: 10px;
        }

        .btn-clear {
            background: transparent;
            border: 1px solid rgba(239, 68, 68, 0.4);
            color: #f87171;
            padding: 6px 12px;
            border-radius: 8px;
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-family: var(--font-family);
        }

        .btn-clear:hover {
            background: var(--danger);
            color: #ffffff;
        }

        /* Buttons & Forms */
        .btn-add {
            background: linear-gradient(135deg, var(--primary) 0%, #cc0000 100%);
            color: #ffffff;
            border: none;
            border-radius: 10px;
            padding: 10px 18px;
            font-size: 0.88rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 8px;
            box-shadow: 0 4px 15px var(--primary-glow);
            font-family: var(--font-family);
        }

        .btn-add:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px var(--primary-glow);
            filter: brightness(1.1);
        }

        /* Interactive Tables */
        .table-responsive {
            width: 100%;
            overflow-x: auto;
            border-radius: 12px;
            border: 1px solid rgba(255, 255, 255, 0.05);
            background: rgba(0, 0, 0, 0.2);
        }

        table {
            width: 100%;
            border-collapse: collapse;
            text-align: left;
            font-size: 0.88rem;
        }

        th {
            background: rgba(15, 12, 25, 0.6);
            color: var(--text-muted);
            font-weight: 600;
            padding: 14px 18px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
            text-transform: uppercase;
            font-size: 0.72rem;
            letter-spacing: 0.5px;
        }

        td {
            padding: 14px 18px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
            color: var(--text-main);
            vertical-align: middle;
        }

        tr:hover td {
            background: rgba(255, 255, 255, 0.015);
        }

        .avatar-cell {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .avatar-img {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            object-fit: cover;
            border: 2px solid var(--border-color);
            background: #11141c;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            color: var(--primary-light);
            font-size: 0.9rem;
        }

        .badge-role {
            background: rgba(239, 68, 68, 0.1);
            color: var(--primary-light);
            border: 1px solid rgba(239, 68, 68, 0.2);
            padding: 3px 8px;
            border-radius: 4px;
            font-size: 0.75rem;
            font-weight: 600;
        }

        /* Action Buttons */
        .action-btns {
            display: flex;
            gap: 8px;
        }

        .btn-action {
            width: 30px;
            height: 30px;
            border-radius: 8px;
            border: none;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
            font-size: 0.8rem;
            color: #ffffff;
        }

        .btn-edit {
            background: rgba(239, 68, 68, 0.15);
            border: 1px solid rgba(239, 68, 68, 0.3);
            color: var(--primary-light);
        }

        .btn-edit:hover {
            background: var(--primary);
            color: #ffffff;
            transform: translateY(-2px);
        }

        .btn-delete {
            background: rgba(239, 68, 68, 0.12);
            border: 1px solid rgba(239, 68, 68, 0.25);
            color: #f87171;
        }

        .btn-delete:hover {
            background: var(--danger);
            color: #ffffff;
            transform: translateY(-2px);
        }

        /* Modals */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(10px);
            z-index: 1000;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
            padding: 20px;
        }

        .modal-overlay.active {
            opacity: 1;
            pointer-events: auto;
        }

        .modal-box {
            background: #151821;
            border: 1px solid var(--border-color);
            border-radius: 20px;
            width: 100%;
            max-width: 450px;
            box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(239, 68, 68, 0.1);
            overflow: hidden;
            transform: scale(0.9);
            transition: transform 0.3s ease;
        }

        .modal-overlay.active .modal-box {
            transform: scale(1);
        }

        .modal-header {
            padding: 20px 25px;
            background: rgba(239, 68, 68, 0.08);
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .modal-title {
            font-size: 1.1rem;
            font-weight: 700;
            color: #ffffff;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .modal-close {
            background: transparent;
            border: none;
            color: var(--text-muted);
            font-size: 1.2rem;
            cursor: pointer;
            transition: color 0.2s;
        }

        .modal-close:hover {
            color: #ffffff;
        }

        .modal-body {
            padding: 25px;
        }

        /* Form Controls */
        .form-group {
            margin-bottom: 18px;
        }

        .form-label {
            display: block;
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--text-muted);
            margin-bottom: 6px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .form-control {
            width: 100%;
            background: rgba(0, 0, 0, 0.4);
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 10px;
            padding: 11px 14px;
            color: var(--text-main);
            font-size: 0.9rem;
            font-family: var(--font-family);
            outline: none;
            transition: all 0.3s;
        }

        .form-control:focus {
            border-color: var(--primary-light);
            box-shadow: 0 0 12px var(--primary-glow);
            background: rgba(0, 0, 0, 0.6);
        }

        .modal-footer {
            padding: 15px 25px 25px;
            display: flex;
            justify-content: flex-end;
            gap: 12px;
            border-top: 1px solid rgba(255, 255, 255, 0.05);
        }

        .btn-cancel {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.08);
            color: var(--text-main);
            padding: 10px 18px;
            border-radius: 10px;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.85rem;
            transition: all 0.2s;
            font-family: var(--font-family);
        }

        .btn-cancel:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        .no-data {
            text-align: center;
            padding: 40px 20px;
            color: var(--text-muted);
            font-family: var(--font-family);
        }

        .no-data i {
            font-size: 2.5rem;
            margin-bottom: 12px;
            display: block;
            opacity: 0.5;
        }

        /* Tabs Switcher */
        .tabs-container {
            display: flex;
            gap: 12px;
            margin-bottom: 25px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
            padding-bottom: 12px;
            flex-wrap: wrap;
        }

        .tab-btn {
            background: transparent;
            border: none;
            color: var(--text-muted);
            font-size: 0.92rem;
            font-weight: 600;
            padding: 10px 18px;
            cursor: pointer;
            border-radius: 8px;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 8px;
            font-family: var(--font-family);
        }

        .tab-btn.active {
            background: rgba(239, 68, 68, 0.15);
            color: #ffffff;
            border: 1px solid var(--border-color);
            box-shadow: 0 0 15px rgba(239, 68, 68, 0.15);
        }

        .tab-btn:hover:not(.active) {
            color: #ffffff;
            background: rgba(255, 255, 255, 0.03);
        }

        .tab-content {
            display: none;
            animation: fadeIn 0.4s ease-out;
        }

        .tab-content.active {
            display: block;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        /* Mobile adaptation & Premium Responsiveness */
        @media (max-width: 992px) {
            .dashboard-grid {
                grid-template-columns: 1fr;
                gap: 25px;
            }
        }

        @media (max-width: 768px) {
            .navbar {
                padding: 12px 20px;
            }

            .container {
                margin: 15px auto;
                padding: 0 15px;
            }

            .panel-card {
                padding: 20px 15px;
            }

            /* Horizontal Scrollable Tabs on Mobile */
            .tabs-container {
                flex-wrap: nowrap;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
                padding-bottom: 8px;
                gap: 8px;
                scrollbar-width: none; /* Firefox */
                -ms-overflow-style: none; /* IE/Edge */
            }

            .tabs-container::-webkit-scrollbar {
                display: none; /* Safari/Chrome */
            }

            .tab-btn {
                flex-shrink: 0;
                white-space: nowrap;
                padding: 8px 14px;
                font-size: 0.85rem;
            }

            .terminal-container {
                height: 350px;
            }

            /* Stackable Terminal Rows on Mobile */
            .terminal-row {
                flex-direction: column;
                gap: 2px;
                padding-bottom: 10px;
            }

            .terminal-time {
                font-size: 0.72rem;
                color: var(--primary-light);
            }

            .terminal-ip {
                margin-left: 0;
                display: block;
                margin-top: 2px;
            }
        }

        @media (max-width: 576px) {
            .nav-brand span {
                font-size: 1rem;
            }

            .nav-brand i {
                font-size: 1.25rem;
            }

            /* Hide User Info details on mobile to preserve layout space */
            .user-info {
                display: none;
            }

            .btn-logout-nav span {
                display: none; /* Show icon only */
            }

            .btn-logout-nav {
                padding: 8px 10px;
            }

            .nav-user {
                gap: 8px;
            }

            .welcome-header h1 {
                font-size: 1.6rem;
            }

            .welcome-header p {
                font-size: 0.85rem;
            }

            .stats-grid {
                grid-template-columns: 1fr;
                gap: 15px;
            }

            .stat-card {
                padding: 16px;
            }

            .stat-value {
                font-size: 1.8rem;
            }

            .stat-icon {
                font-size: 1.8rem;
            }

            .panel-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 12px;
            }

            .btn-add {
                width: 100%;
                justify-content: center;
            }

            .terminal-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 8px;
            }

            .terminal-search {
                width: 100%;
            }

            .modal-box {
                border-radius: 16px;
            }

            .modal-body, .modal-footer {
                padding: 20px;
            }
        }
    </style>
</head>
<body>

    <!-- Header Navbar -->
    <nav class="navbar">
        <a href="/" class="nav-brand">
            <i class="fa-solid fa-shield-halved"></i>
            <span>Admin Area</span>
        </a>
        <div class="nav-user">
            <div class="user-info">
                <div class="user-name"><?php echo e($adminName); ?></div>
                <div class="user-role">Super Admin</div>
            </div>
            <form action="<?php echo e(route('admin.logout')); ?>" method="POST">
                <?php echo csrf_field(); ?>
                <button type="submit" class="btn-logout-nav">
                    <i class="fa-solid fa-right-from-bracket"></i>
                    <span>Keluar</span>
                </button>
            </form>
        </div>
    </nav>

    <!-- Main Container -->
    <div class="container">

        <div class="welcome-header">
            <h1>Dashboard Keamanan Admin</h1>
            <p>Kelola seluruh otorisasi akun (Admin, Petugas, Alumni) dan data Siswa secara terpusat.</p>
        </div>

        <!-- Success & Danger Alerts -->
        <?php if(session('success')): ?>
            <div class="alert">
                <i class="fa-solid fa-circle-check"></i>
                <span><?php echo e(session('success')); ?></span>
            </div>
        <?php endif; ?>

        <?php if($errors->any()): ?>
            <div class="alert alert-danger">
                <i class="fa-solid fa-triangle-exclamation"></i>
                <span><?php echo e($errors->first()); ?></span>
            </div>
        <?php endif; ?>

        <!-- Tab Switcher -->
        <div class="tabs-container">
            <button class="tab-btn active" id="tab-logs-btn" onclick="switchTab('logs')">
                <i class="fa-solid fa-terminal"></i> Log & Statistik
            </button>
            <button class="tab-btn" id="tab-petugas-btn" onclick="switchTab('petugas')">
                <i class="fa-solid fa-users-gear"></i> Staff Petugas
            </button>
            <button class="tab-btn" id="tab-admins-btn" onclick="switchTab('admins')">
                <i class="fa-solid fa-user-shield"></i> Akun Admin
            </button>
            <button class="tab-btn" id="tab-alumni-btn" onclick="switchTab('alumni')">
                <i class="fa-solid fa-user-tie"></i> Data Alumni
            </button>
            <button class="tab-btn" id="tab-siswa-btn" onclick="switchTab('siswa')">
                <i class="fa-solid fa-graduation-cap"></i> Data Siswa
            </button>
            <button class="tab-btn" id="tab-profil-btn" onclick="switchTab('profil')">
                <i class="fa-solid fa-user-pen"></i> Profil Saya
            </button>
        </div>

        <!-- TAB 1: LOGS & STATISTIK -->
        <div class="tab-content active" id="content-logs">
            <!-- Stats Grid -->
            <div class="stats-grid">
                <div class="stat-card">
                    <div>
                        <div class="stat-value"><?php echo e($stats['total_siswa']); ?></div>
                        <div class="stat-label">Siswa Aktif</div>
                    </div>
                    <i class="fa-solid fa-graduation-cap stat-icon"></i>
                </div>
                <div class="stat-card">
                    <div>
                        <div class="stat-value"><?php echo e($stats['total_alumni']); ?></div>
                        <div class="stat-label">Alumni Tracer</div>
                    </div>
                    <i class="fa-solid fa-user-tie stat-icon"></i>
                </div>
                <div class="stat-card">
                    <div>
                        <div class="stat-value"><?php echo e($stats['total_petugas']); ?></div>
                        <div class="stat-label">Akun Petugas</div>
                    </div>
                    <i class="fa-solid fa-users-gear stat-icon"></i>
                </div>
                <div class="stat-card">
                    <div>
                        <div class="stat-value"><?php echo e($stats['total_admin']); ?></div>
                        <div class="stat-label">Akun Admin</div>
                    </div>
                    <i class="fa-solid fa-shield-halved stat-icon"></i>
                </div>
            </div>

            <div class="panel-card">
                <div class="panel-header">
                    <div class="panel-title">
                        <i class="fa-solid fa-terminal"></i>
                        <span>Terminal Log Audit Aktifitas</span>
                    </div>
                    <?php if(count($logs) > 0): ?>
                        <form action="<?php echo e(route('admin.dashboard.clear-logs')); ?>" method="POST" onsubmit="return confirm('Apakah Anda yakin ingin mengosongkan terminal log?')">
                            <?php echo csrf_field(); ?>
                            <button type="submit" class="btn-clear">
                                <i class="fa-solid fa-eraser"></i>
                                Bersihkan Terminal
                            </button>
                        </form>
                    <?php endif; ?>
                </div>

                <div class="terminal-container">
                    <div class="terminal-header">
                        <span>SYSTEM LOG AUDIT ACTIVE</span>
                        <input type="text" id="terminal-search-input" class="terminal-search" placeholder="Cari log aktifitas..." onkeyup="filterLogs()">
                    </div>
                    <div class="terminal-body" id="terminal-log-rows">
                        <?php $__empty_1 = true; $__currentLoopData = $logs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $log): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <div class="terminal-row" data-search-text="<?php echo e(strtolower($log->user_name . ' ' . $log->activity)); ?>">
                                <span class="terminal-time">[<?php echo e(\Carbon\Carbon::parse($log->created_at)->format('d/M/Y H:i:s')); ?>]</span>
                                <span class="terminal-user">&gt; <?php echo e($log->user_name); ?></span>
                                <span class="terminal-action"><?php echo e($log->activity); ?></span>
                                <span class="terminal-ip">IP: <?php echo e($log->ip_address ?? '127.0.0.1'); ?></span>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <div style="color:#555; text-align:center; padding-top:120px;">
                                [ SYSTEM IDLE - LOG KOSONG ]
                            </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>

        <!-- TAB 2: STAFF PETUGAS (CRUD) -->
        <div class="tab-content" id="content-petugas">
            <div class="panel-card">
                <div class="panel-header">
                    <div class="panel-title">
                        <i class="fa-solid fa-user-gear"></i>
                        <span>Manajemen Akun Staff Petugas</span>
                    </div>
                    <button class="btn-add" onclick="openModal('modal-add-petugas')">
                        <i class="fa-solid fa-plus"></i> Tambah Staff
                    </button>
                </div>

                <div class="table-responsive">
                    <table>
                        <thead>
                            <tr>
                                <th>Petugas</th>
                                <th>Username</th>
                                <th>Aksi</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__empty_1 = true; $__currentLoopData = $petugas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <tr>
                                    <td>
                                        <div class="avatar-cell">
                                            <?php if($item->foto && $item->foto !== 'default_petugas.jpg' && file_exists(public_path($item->foto))): ?>
                                                <img class="avatar-img" src="<?php echo e(asset($item->foto)); ?>" alt="Foto">
                                            <?php else: ?>
                                                <div class="avatar-img"><?php echo e(substr($item->nama_petugas, 0, 1)); ?></div>
                                            <?php endif; ?>
                                            <div>
                                                <div style="font-weight:600;"><?php echo e($item->nama_petugas); ?></div>
                                                <div style="font-size:0.75rem; color:var(--text-muted);"><?php echo e($item->jabatan); ?></div>
                                            </div>
                                        </div>
                                    </td>
                                    <td style="font-family:monospace;"><?php echo e($item->username); ?></td>
                                    <td>
                                        <div class="action-btns">
                                            <button class="btn-action btn-edit" onclick="openEditPetugasModal('<?php echo e($item->id_petugas); ?>', '<?php echo e(addslashes($item->nama_petugas)); ?>', '<?php echo e(addslashes($item->username)); ?>', '<?php echo e(addslashes($item->jabatan)); ?>')">
                                                <i class="fa-solid fa-pen-to-square"></i>
                                            </button>
                                            <form action="<?php echo e(route('admin.dashboard.petugas.destroy', $item->id_petugas)); ?>" method="POST" onsubmit="return confirm('Apakah Anda yakin ingin menghapus akun Petugas ini?')">
                                                <?php echo csrf_field(); ?>
                                                <?php echo method_field('DELETE'); ?>
                                                <button type="submit" class="btn-action btn-delete">
                                                    <i class="fa-solid fa-trash-can"></i>
                                                </button>
                                            </form>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <tr>
                                    <td colspan="3">
                                        <div class="no-data">
                                            <i class="fa-solid fa-folder-open"></i>
                                            Belum ada petugas terdaftar.
                                        </div>
                                    </td>
                                </tr>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        <!-- TAB 3: AKUN ADMIN (CRUD) -->
        <div class="tab-content" id="content-admins">
            <div class="panel-card">
                <div class="panel-header">
                    <div class="panel-title">
                        <i class="fa-solid fa-user-shield"></i>
                        <span>Manajemen Akun Administrator</span>
                    </div>
                    <button class="btn-add" onclick="openModal('modal-add-admin')">
                        <i class="fa-solid fa-plus"></i> Tambah Admin
                    </button>
                </div>

                <div class="table-responsive">
                    <table>
                        <thead>
                            <tr>
                                <th>Admin</th>
                                <th>Username</th>
                                <th>Level</th>
                                <th>Aksi</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__empty_1 = true; $__currentLoopData = $admins; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <tr>
                                    <td>
                                        <div class="avatar-cell">
                                            <?php if($item->foto && $item->foto !== 'default_admin.jpg' && file_exists(public_path($item->foto))): ?>
                                                <img class="avatar-img" src="<?php echo e(asset($item->foto)); ?>" alt="Foto">
                                            <?php else: ?>
                                                <div class="avatar-img"><?php echo e(substr($item->nama_admin, 0, 1)); ?></div>
                                            <?php endif; ?>
                                            <div>
                                                <div style="font-weight:600;"><?php echo e($item->nama_admin); ?></div>
                                            </div>
                                        </div>
                                    </td>
                                    <td style="font-family:monospace;"><?php echo e($item->username); ?></td>
                                    <td>
                                        <span class="badge-role" style="background: rgba(239, 68, 68, 0.12); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.25);">
                                            <?php echo e($item->level); ?>

                                        </span>
                                    </td>
                                    <td>
                                        <div class="action-btns">
                                            <button class="btn-action btn-edit" onclick="openEditAdminModal('<?php echo e($item->id_admin); ?>', '<?php echo e(addslashes($item->nama_admin)); ?>', '<?php echo e(addslashes($item->username)); ?>')">
                                                <i class="fa-solid fa-pen-to-square"></i>
                                            </button>
                                            <?php if($item->id_admin != $currentAdmin->id_admin): ?>
                                                <form action="<?php echo e(route('admin.dashboard.admin.destroy', $item->id_admin)); ?>" method="POST" onsubmit="return confirm('Apakah Anda yakin ingin menghapus akun Admin ini?')">
                                                    <?php echo csrf_field(); ?>
                                                    <?php echo method_field('DELETE'); ?>
                                                    <button type="submit" class="btn-action btn-delete">
                                                        <i class="fa-solid fa-trash-can"></i>
                                                    </button>
                                                </form>
                                            <?php endif; ?>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <tr>
                                    <td colspan="4">
                                        <div class="no-data">
                                            <i class="fa-solid fa-folder-open"></i>
                                            Belum ada admin terdaftar.
                                        </div>
                                    </td>
                                </tr>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        <!-- TAB 4: DATA ALUMNI (CRUD) -->
        <div class="tab-content" id="content-alumni">
            <div class="panel-card">
                <div class="panel-header">
                    <div class="panel-title">
                        <i class="fa-solid fa-user-tie"></i>
                        <span>Manajemen Akun Alumni</span>
                    </div>
                    <button class="btn-add" onclick="openModal('modal-add-alumni')">
                        <i class="fa-solid fa-plus"></i> Tambah Alumni
                    </button>
                </div>

                <div class="table-responsive">
                    <table>
                        <thead>
                            <tr>
                                <th>Alumni</th>
                                <th>Tahun Lulus</th>
                                <th>Status</th>
                                <th>Instansi</th>
                                <th>Jabatan / Prodi</th>
                                <th>Aksi</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__empty_1 = true; $__currentLoopData = $alumni; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <tr>
                                    <td>
                                        <div class="avatar-cell">
                                            <?php if($item->foto && $item->foto !== 'default_alumni.jpg' && file_exists(public_path($item->foto))): ?>
                                                <img class="avatar-img" src="<?php echo e(asset($item->foto)); ?>" alt="Foto">
                                            <?php else: ?>
                                                <div class="avatar-img"><?php echo e(substr($item->nama, 0, 1)); ?></div>
                                            <?php endif; ?>
                                            <div>
                                                <div style="font-weight:600;"><?php echo e($item->nama); ?></div>
                                                <div style="font-size:0.75rem; color:var(--text-muted)">@ <?php echo e($item->username); ?></div>
                                            </div>
                                        </div>
                                    </td>
                                    <td><?php echo e($item->tahun_lulus); ?></td>
                                    <td>
                                        <span class="badge-role" style="background: <?php echo e($item->kelanjutan === 'kerja' ? 'rgba(16, 185, 129, 0.12)' : 'rgba(59, 130, 246, 0.12)'); ?>; color: <?php echo e($item->kelanjutan === 'kerja' ? '#34d399' : '#60a5fa'); ?>; border: 1px solid <?php echo e($item->kelanjutan === 'kerja' ? 'rgba(16, 185, 129, 0.25)' : 'rgba(59, 130, 246, 0.25)'); ?>;">
                                            <?php echo e(ucfirst($item->kelanjutan)); ?>

                                        </span>
                                    </td>
                                    <td><?php echo e($item->tempat); ?></td>
                                    <td><?php echo e($item->jabatan); ?></td>
                                    <td>
                                        <div class="action-btns">
                                            <button class="btn-action btn-edit" onclick="openEditAlumniModal('<?php echo e($item->id_alumni); ?>', '<?php echo e(addslashes($item->nama)); ?>', '<?php echo e($item->tahun_lulus); ?>', '<?php echo e($item->kelanjutan); ?>', '<?php echo e(addslashes($item->tempat)); ?>', '<?php echo e(addslashes($item->jabatan)); ?>', '<?php echo e(addslashes($item->testimoni)); ?>', '<?php echo e(addslashes($item->username)); ?>')">
                                                <i class="fa-solid fa-pen-to-square"></i>
                                            </button>
                                            <form action="<?php echo e(route('admin.dashboard.alumni.destroy', $item->id_alumni)); ?>" method="POST" onsubmit="return confirm('Apakah Anda yakin ingin menghapus data Alumni ini?')">
                                                <?php echo csrf_field(); ?>
                                                <?php echo method_field('DELETE'); ?>
                                                <button type="submit" class="btn-action btn-delete">
                                                    <i class="fa-solid fa-trash-can"></i>
                                                </button>
                                            </form>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <tr>
                                    <td colspan="6">
                                        <div class="no-data">
                                            <i class="fa-solid fa-folder-open"></i>
                                            Belum ada alumni terdaftar.
                                        </div>
                                    </td>
                                </tr>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        <!-- TAB 5: DATA SISWA (CRUD) -->
        <div class="tab-content" id="content-siswa">
            <div class="panel-card">
                <div class="panel-header">
                    <div class="panel-title">
                        <i class="fa-solid fa-graduation-cap"></i>
                        <span>Manajemen Data Siswa Otomotif</span>
                    </div>
                    <button class="btn-add" onclick="openModal('modal-add-siswa')">
                        <i class="fa-solid fa-plus"></i> Tambah Siswa
                    </button>
                </div>

                <div class="table-responsive">
                    <table>
                        <thead>
                            <tr>
                                <th>Siswa</th>
                                <th>NIS</th>
                                <th>Kelas</th>
                                <th>Gender</th>
                                <th>Alamat</th>
                                <th>Aksi</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__empty_1 = true; $__currentLoopData = $siswa; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <tr>
                                    <td>
                                        <div class="avatar-cell">
                                            <?php if($item->foto && $item->foto !== 'default_avatar.png' && file_exists(public_path($item->foto))): ?>
                                                <img class="avatar-img" src="<?php echo e(asset($item->foto)); ?>" alt="Foto">
                                            <?php else: ?>
                                                <div class="avatar-img"><?php echo e(substr($item->nama_siswa, 0, 1)); ?></div>
                                            <?php endif; ?>
                                            <div>
                                                <div style="font-weight:600;"><?php echo e($item->nama_siswa); ?></div>
                                            </div>
                                        </div>
                                    </td>
                                    <td style="font-family: monospace;"><?php echo e($item->nis); ?></td>
                                    <td><?php echo e($item->kelas); ?></td>
                                    <td>
                                        <span class="badge-role" style="background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.08);">
                                            <?php echo e(ucfirst($item->jk)); ?>

                                        </span>
                                    </td>
                                    <td><?php echo e($item->alamat); ?></td>
                                    <td>
                                        <div class="action-btns">
                                            <button class="btn-action btn-edit" onclick="openEditSiswaModal('<?php echo e($item->nis); ?>', '<?php echo e(addslashes($item->nama_siswa)); ?>', '<?php echo e(addslashes($item->kelas)); ?>', '<?php echo e($item->jk); ?>', '<?php echo e(addslashes($item->alamat)); ?>')">
                                                <i class="fa-solid fa-pen-to-square"></i>
                                            </button>
                                            <form action="<?php echo e(route('admin.dashboard.siswa.destroy', $item->nis)); ?>" method="POST" onsubmit="return confirm('Apakah Anda yakin ingin menghapus data Siswa ini?')">
                                                <?php echo csrf_field(); ?>
                                                <?php echo method_field('DELETE'); ?>
                                                <button type="submit" class="btn-action btn-delete">
                                                    <i class="fa-solid fa-trash-can"></i>
                                                </button>
                                            </form>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <tr>
                                    <td colspan="6">
                                        <div class="no-data">
                                            <i class="fa-solid fa-folder-open"></i>
                                            Belum ada siswa terdaftar.
                                        </div>
                                    </td>
                                </tr>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        <!-- TAB 6: PROFIL SAYA (PROFILE EDIT) -->
        <div class="tab-content" id="content-profil">
            <div class="panel-card" style="max-width: 600px; margin: 0 auto;">
                <div class="panel-header">
                    <div class="panel-title">
                        <i class="fa-solid fa-user-pen"></i>
                        <span>Pengaturan Profil Pribadi</span>
                    </div>
                </div>

                <form action="<?php echo e(route('admin.profile.update')); ?>" method="POST" enctype="multipart/form-data">
                    <?php echo csrf_field(); ?>
                    <?php echo method_field('PUT'); ?>
                    
                    <div style="text-align: center; margin-bottom: 25px;">
                        <?php if($currentAdmin->foto && $currentAdmin->foto !== 'default_admin.jpg' && file_exists(public_path($currentAdmin->foto))): ?>
                            <img src="<?php echo e(asset($currentAdmin->foto)); ?>" alt="Avatar" style="width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary); box-shadow: 0 0 15px var(--primary-glow);">
                        <?php else: ?>
                            <div style="width: 110px; height: 110px; border-radius: 50%; background: linear-gradient(135deg, var(--primary) 0%, rgba(255,255,255,0.05) 100%); margin: 0 auto; display: flex; align-items: center; justify-content: center; font-size: 2.8rem; font-weight: 800; color: #ffffff; border: 3px solid var(--primary); box-shadow: 0 0 15px var(--primary-glow);">
                                <?php echo e(substr($currentAdmin->nama_admin, 0, 1)); ?>

                            </div>
                        <?php endif; ?>
                        <div style="margin-top: 12px; font-size: 0.85rem; color: var(--text-muted);">Format foto: JPG, PNG, GIF (Maks. 2MB)</div>
                    </div>

                    <div class="form-group">
                        <label class="form-label" for="profile_nama">Nama Lengkap</label>
                        <input type="text" id="profile_nama" name="nama_admin" class="form-control" value="<?php echo e($currentAdmin->nama_admin); ?>" required>
                    </div>

                    <div class="form-group">
                        <label class="form-label" for="profile_username">Username</label>
                        <input type="text" id="profile_username" name="username" class="form-control" value="<?php echo e($currentAdmin->username); ?>" required>
                    </div>

                    <div class="form-group">
                        <label class="form-label" for="profile_password">Ubah Password</label>
                        <input type="password" id="profile_password" name="password" class="form-control" placeholder="Biarkan kosong jika tidak ingin mengubah password">
                    </div>

                    <div class="form-group">
                        <label class="form-label" for="profile_foto">Foto Profil</label>
                        <input type="file" id="profile_foto" name="foto" class="form-control" accept="image/*">
                    </div>

                    <button type="submit" class="btn-add" style="width: 100%; justify-content: center; margin-top: 15px; padding: 12px;">
                        <i class="fa-solid fa-save"></i> Simpan Perubahan Profil
                    </button>
                </form>
            </div>
        </div>

    </div>

    <!-- MODAL: TAMBAH PETUGAS -->
    <div class="modal-overlay" id="modal-add-petugas">
        <div class="modal-box">
            <div class="modal-header">
                <div class="modal-title">
                    <i class="fa-solid fa-user-plus"></i>
                    <span>Daftarkan Petugas Baru</span>
                </div>
                <button class="modal-close" onclick="closeModal('modal-add-petugas')">&times;</button>
            </div>
            <form action="<?php echo e(route('admin.dashboard.petugas.store')); ?>" method="POST">
                <?php echo csrf_field(); ?>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="form-label" for="add_nama">Nama Lengkap</label>
                        <input type="text" id="add_nama" name="nama_petugas" class="form-control" placeholder="Nama petugas..." required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_jabatan">Jabatan</label>
                        <input type="text" id="add_jabatan" name="jabatan" class="form-control" placeholder="Contoh: Staf Bengkel TKR" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_username">Username</label>
                        <input type="text" id="add_username" name="username" class="form-control" placeholder="Username baru..." required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_password">Password</label>
                        <input type="password" id="add_password" name="password" class="form-control" placeholder="Min 6 karakter..." required>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn-cancel" onclick="closeModal('modal-add-petugas')">Batal</button>
                    <button type="submit" class="btn-add">Daftarkan Akun</button>
                </div>
            </form>
        </div>
    </div>

    <!-- MODAL: EDIT PETUGAS -->
    <div class="modal-overlay" id="modal-edit-petugas">
        <div class="modal-box">
            <div class="modal-header">
                <div class="modal-title">
                    <i class="fa-solid fa-user-pen"></i>
                    <span>Sunting Akun Petugas</span>
                </div>
                <button class="modal-close" onclick="closeModal('modal-edit-petugas')">&times;</button>
            </div>
            <form id="form-edit-petugas" method="POST">
                <?php echo csrf_field(); ?>
                <?php echo method_field('PUT'); ?>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="form-label" for="edit_nama">Nama Lengkap</label>
                        <input type="text" id="edit_nama" name="nama_petugas" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_jabatan">Jabatan</label>
                        <input type="text" id="edit_jabatan" name="jabatan" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_username">Username</label>
                        <input type="text" id="edit_username" name="username" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_password">Ubah Password</label>
                        <input type="password" id="edit_password" name="password" class="form-control" placeholder="Biarkan kosong jika tidak diubah">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn-cancel" onclick="closeModal('modal-edit-petugas')">Batal</button>
                    <button type="submit" class="btn-add">Simpan Perubahan</button>
                </div>
            </form>
        </div>
    </div>

    <!-- MODAL: TAMBAH ADMIN -->
    <div class="modal-overlay" id="modal-add-admin">
        <div class="modal-box">
            <div class="modal-header">
                <div class="modal-title">
                    <i class="fa-solid fa-user-shield"></i>
                    <span>Daftarkan Admin Baru</span>
                </div>
                <button class="modal-close" onclick="closeModal('modal-add-admin')">&times;</button>
            </div>
            <form action="<?php echo e(route('admin.register.submit')); ?>" method="POST">
                <?php echo csrf_field(); ?>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="form-label" for="add_admin_nama">Nama Lengkap</label>
                        <input type="text" id="add_admin_nama" name="nama_admin" class="form-control" placeholder="Nama admin..." required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_admin_username">Username</label>
                        <input type="text" id="add_admin_username" name="username" class="form-control" placeholder="Username baru..." required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_admin_password">Password</label>
                        <input type="password" id="add_admin_password" name="password" class="form-control" placeholder="Min 6 karakter..." required>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn-cancel" onclick="closeModal('modal-add-admin')">Batal</button>
                    <button type="submit" class="btn-add">Daftarkan Admin</button>
                </div>
            </form>
        </div>
    </div>

    <!-- MODAL: EDIT ADMIN -->
    <div class="modal-overlay" id="modal-edit-admin">
        <div class="modal-box">
            <div class="modal-header">
                <div class="modal-title">
                    <i class="fa-solid fa-user-pen"></i>
                    <span>Sunting Akun Admin</span>
                </div>
                <button class="modal-close" onclick="closeModal('modal-edit-admin')">&times;</button>
            </div>
            <form id="form-edit-admin" method="POST">
                <?php echo csrf_field(); ?>
                <?php echo method_field('PUT'); ?>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="form-label" for="edit_admin_nama_val">Nama Lengkap</label>
                        <input type="text" id="edit_admin_nama_val" name="nama_admin" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_admin_username_val">Username</label>
                        <input type="text" id="edit_admin_username_val" name="username" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_admin_password_val">Ubah Password</label>
                        <input type="password" id="edit_admin_password_val" name="password" class="form-control" placeholder="Biarkan kosong jika tidak diubah">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn-cancel" onclick="closeModal('modal-edit-admin')">Batal</button>
                    <button type="submit" class="btn-add">Simpan Perubahan</button>
                </div>
            </form>
        </div>
    </div>

    <!-- MODAL: TAMBAH ALUMNI -->
    <div class="modal-overlay" id="modal-add-alumni">
        <div class="modal-box" style="max-width: 550px;">
            <div class="modal-header">
                <div class="modal-title">
                    <i class="fa-solid fa-user-plus"></i>
                    <span>Daftarkan Alumni Baru</span>
                </div>
                <button class="modal-close" onclick="closeModal('modal-add-alumni')">&times;</button>
            </div>
            <form action="<?php echo e(route('admin.dashboard.alumni.store')); ?>" method="POST" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>
                <div class="modal-body" style="max-height: 65vh; overflow-y: auto;">
                    <div class="form-group">
                        <label class="form-label" for="add_alumni_nama">Nama Lengkap</label>
                        <input type="text" id="add_alumni_nama" name="nama" class="form-control" placeholder="Nama alumni..." required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_alumni_tahun">Tahun Lulus</label>
                        <input type="number" id="add_alumni_tahun" name="tahun_lulus" class="form-control" placeholder="Tahun kelulusan..." min="1900" max="<?php echo e(date('Y')+1); ?>" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_alumni_kelanjutan">Kelanjutan</label>
                        <select id="add_alumni_kelanjutan" name="kelanjutan" class="form-control" required style="background-color:#08090c; color:var(--text-main);">
                            <option value="kerja">Kerja</option>
                            <option value="kuliah">Kuliah</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_alumni_tempat">Tempat / Instansi</label>
                        <input type="text" id="add_alumni_tempat" name="tempat" class="form-control" placeholder="PT / Universitas..." required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_alumni_jabatan">Jabatan / Prodi</label>
                        <input type="text" id="add_alumni_jabatan" name="jabatan" class="form-control" placeholder="Mekanik / S1 Teknik..." required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_alumni_username">Username</label>
                        <input type="text" id="add_alumni_username" name="username" class="form-control" placeholder="Username untuk login..." required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_alumni_password">Password</label>
                        <input type="password" id="add_alumni_password" name="password" class="form-control" placeholder="Min 6 karakter..." required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_alumni_testimoni">Testimoni</label>
                        <textarea id="add_alumni_testimoni" name="testimoni" class="form-control" placeholder="Pesan kesan untuk sekolah..." required></textarea>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_alumni_foto">Foto Alumni</label>
                        <input type="file" id="add_alumni_foto" name="foto" class="form-control" accept="image/*">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn-cancel" onclick="closeModal('modal-add-alumni')">Batal</button>
                    <button type="submit" class="btn-add">Daftarkan Alumni</button>
                </div>
            </form>
        </div>
    </div>

    <!-- MODAL: EDIT ALUMNI -->
    <div class="modal-overlay" id="modal-edit-alumni">
        <div class="modal-box" style="max-width: 550px;">
            <div class="modal-header">
                <div class="modal-title">
                    <i class="fa-solid fa-user-pen"></i>
                    <span>Sunting Data Alumni</span>
                </div>
                <button class="modal-close" onclick="closeModal('modal-edit-alumni')">&times;</button>
            </div>
            <form id="form-edit-alumni" method="POST" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>
                <?php echo method_field('PUT'); ?>
                <div class="modal-body" style="max-height: 65vh; overflow-y: auto;">
                    <div class="form-group">
                        <label class="form-label" for="edit_alumni_nama">Nama Lengkap</label>
                        <input type="text" id="edit_alumni_nama" name="nama" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_alumni_tahun">Tahun Lulus</label>
                        <input type="number" id="edit_alumni_tahun" name="tahun_lulus" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_alumni_kelanjutan">Kelanjutan</label>
                        <select id="edit_alumni_kelanjutan" name="kelanjutan" class="form-control" required style="background-color:#08090c; color:var(--text-main);">
                            <option value="kerja">Kerja</option>
                            <option value="kuliah">Kuliah</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_alumni_tempat">Tempat / Instansi</label>
                        <input type="text" id="edit_alumni_tempat" name="tempat" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_alumni_jabatan">Jabatan / Prodi</label>
                        <input type="text" id="edit_alumni_jabatan" name="jabatan" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_alumni_username">Username</label>
                        <input type="text" id="edit_alumni_username" name="username" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_alumni_password">Ubah Password</label>
                        <input type="password" id="edit_alumni_password" name="password" class="form-control" placeholder="Biarkan kosong jika tidak diubah">
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_alumni_testimoni">Testimoni</label>
                        <textarea id="edit_alumni_testimoni" name="testimoni" class="form-control" required></textarea>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_alumni_foto">Foto Alumni (Opsional)</label>
                        <input type="file" id="edit_alumni_foto" name="foto" class="form-control" accept="image/*">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn-cancel" onclick="closeModal('modal-edit-alumni')">Batal</button>
                    <button type="submit" class="btn-add">Simpan Perubahan</button>
                </div>
            </form>
        </div>
    </div>

    <!-- MODAL: TAMBAH SISWA -->
    <div class="modal-overlay" id="modal-add-siswa">
        <div class="modal-box">
            <div class="modal-header">
                <div class="modal-title">
                    <i class="fa-solid fa-graduation-cap"></i>
                    <span>Daftarkan Siswa Baru</span>
                </div>
                <button class="modal-close" onclick="closeModal('modal-add-siswa')">&times;</button>
            </div>
            <form action="<?php echo e(route('admin.dashboard.siswa.store')); ?>" method="POST" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="form-label" for="add_siswa_nama">Nama Lengkap</label>
                        <input type="text" id="add_siswa_nama" name="nama_siswa" class="form-control" placeholder="Nama siswa..." required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_siswa_kelas">Kelas</label>
                        <input type="text" id="add_siswa_kelas" name="kelas" class="form-control" placeholder="Contoh: XII TKR 1" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_siswa_jk">Jenis Kelamin</label>
                        <select id="add_siswa_jk" name="jk" class="form-control" required style="background-color:#08090c; color:var(--text-main);">
                            <option value="laki-laki">Laki-laki</option>
                            <option value="perempuan">Perempuan</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_siswa_alamat">Alamat Tinggal</label>
                        <input type="text" id="add_siswa_alamat" name="alamat" class="form-control" placeholder="Alamat lengkap..." required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="add_siswa_foto">Foto Siswa</label>
                        <input type="file" id="add_siswa_foto" name="foto" class="form-control" accept="image/*">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn-cancel" onclick="closeModal('modal-add-siswa')">Batal</button>
                    <button type="submit" class="btn-add">Daftarkan Siswa</button>
                </div>
            </form>
        </div>
    </div>

    <!-- MODAL: EDIT SISWA -->
    <div class="modal-overlay" id="modal-edit-siswa">
        <div class="modal-box">
            <div class="modal-header">
                <div class="modal-title">
                    <i class="fa-solid fa-user-pen"></i>
                    <span>Sunting Data Siswa</span>
                </div>
                <button class="modal-close" onclick="closeModal('modal-edit-siswa')">&times;</button>
            </div>
            <form id="form-edit-siswa" method="POST" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>
                <?php echo method_field('PUT'); ?>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="form-label" for="edit_siswa_nama">Nama Lengkap</label>
                        <input type="text" id="edit_siswa_nama" name="nama_siswa" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_siswa_kelas">Kelas</label>
                        <input type="text" id="edit_siswa_kelas" name="kelas" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_siswa_jk">Jenis Kelamin</label>
                        <select id="edit_siswa_jk" name="jk" class="form-control" required style="background-color:#08090c; color:var(--text-main);">
                            <option value="laki-laki">Laki-laki</option>
                            <option value="perempuan">Perempuan</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_siswa_alamat">Alamat Tinggal</label>
                        <input type="text" id="edit_siswa_alamat" name="alamat" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="edit_siswa_foto">Foto Siswa (Opsional)</label>
                        <input type="file" id="edit_siswa_foto" name="foto" class="form-control" accept="image/*">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn-cancel" onclick="closeModal('modal-edit-siswa')">Batal</button>
                    <button type="submit" class="btn-add">Simpan Perubahan</button>
                </div>
            </form>
        </div>
    </div>

    <script>
        // TAB SWAP SYSTEM
        function switchTab(tabId) {
            // Hide all tab contents
            document.querySelectorAll('.tab-content').forEach(content => {
                content.classList.remove('active');
            });
            // Deactivate all tab buttons
            document.querySelectorAll('.tab-btn').forEach(btn => {
                btn.classList.remove('active');
            });
            // Show selected tab content & activate button
            document.getElementById('content-' + tabId).classList.add('active');
            document.getElementById('tab-' + tabId + '-btn').classList.add('active');
        }

        // MODAL LOGIC
        function openModal(modalId) {
            document.getElementById(modalId).classList.add('active');
        }

        function closeModal(modalId) {
            document.getElementById(modalId).classList.remove('active');
        }

        // POPULATE EDIT PETUGAS MODAL
        function openEditPetugasModal(id, nama, username, jabatan) {
            const form = document.getElementById('form-edit-petugas');
            form.action = `/admin/dashboard/petugas/${id}`;
            
            document.getElementById('edit_nama').value = nama;
            document.getElementById('edit_username').value = username;
            document.getElementById('edit_jabatan').value = jabatan;
            document.getElementById('edit_password').value = '';

            openModal('modal-edit-petugas');
        }

        // POPULATE EDIT ADMIN MODAL
        function openEditAdminModal(id, nama, username) {
            const form = document.getElementById('form-edit-admin');
            form.action = `/admin/dashboard/admin/${id}`;
            
            document.getElementById('edit_admin_nama_val').value = nama;
            document.getElementById('edit_admin_username_val').value = username;
            document.getElementById('edit_admin_password_val').value = '';

            openModal('modal-edit-admin');
        }

        // POPULATE EDIT ALUMNI MODAL
        function openEditAlumniModal(id, nama, tahun, kelanjutan, tempat, jabatan, testimoni, username) {
            const form = document.getElementById('form-edit-alumni');
            form.action = `/admin/dashboard/alumni/${id}`;
            
            document.getElementById('edit_alumni_nama').value = nama;
            document.getElementById('edit_alumni_tahun').value = tahun;
            document.getElementById('edit_alumni_kelanjutan').value = kelanjutan;
            document.getElementById('edit_alumni_tempat').value = tempat;
            document.getElementById('edit_alumni_jabatan').value = jabatan;
            document.getElementById('edit_alumni_username').value = username;
            document.getElementById('edit_alumni_password').value = '';
            document.getElementById('edit_alumni_testimoni').value = testimoni;

            openModal('modal-edit-alumni');
        }

        // POPULATE EDIT SISWA MODAL
        function openEditSiswaModal(nis, nama, kelas, jk, alamat) {
            const form = document.getElementById('form-edit-siswa');
            form.action = `/admin/dashboard/siswa/${nis}`;
            
            document.getElementById('edit_siswa_nama').value = nama;
            document.getElementById('edit_siswa_kelas').value = kelas;
            document.getElementById('edit_siswa_jk').value = jk;
            document.getElementById('edit_siswa_alamat').value = alamat;

            openModal('modal-edit-siswa');
        }

        // LIVE TERMINAL LOG FILTER
        function filterLogs() {
            const input = document.getElementById('terminal-search-input');
            const filter = input.value.toLowerCase();
            const rows = document.querySelectorAll('#terminal-log-rows .terminal-row');

            rows.forEach(row => {
                const text = row.getAttribute('data-search-text');
                if (text.includes(filter)) {
                    row.style.display = '';
                } else {
                    row.style.display = 'none';
                }
            });
        }

        // Close modal when clicking on overlay
        window.onclick = function(event) {
            if (event.target.classList.contains('modal-overlay')) {
                event.target.classList.remove('active');
            }
        }
    </script>
</body>
</html>
<?php /**PATH D:\laragon\www\Otomotif_by_PPLG\resources\views/dashboard/admin.blade.php ENDPATH**/ ?>