:root {
    /* LIGHT MODE */
    --bg: #e9eef5; --text: #2d3748; --muted: #718096;
    --primary: #0ea5e9; --primary-hover: #0284c7;
    --danger: #ef4444; --success: #10b981;
    --shadow-dark: #c5d2e0; --shadow-light: #ffffff;
    --border: rgba(255, 255, 255, 0.6);
}
html[data-theme="dark"] {
    /* DARK MODE */
    --bg: #22272e; --text: #e2e8f0; --muted: #94a3b8;
    --primary: #0ea5e9; --primary-hover: #0284c7;
    --danger: #f43f5e; --success: #10b981;
    --shadow-dark: #181b20; --shadow-light: #2c333c;
    --border: rgba(0, 0, 0, 0.2);
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, sans-serif; }

/* ================= GLOBAL BODY ================= */
body { background: var(--bg); color: var(--text); min-height: 100vh; transition: background 0.4s ease, color 0.4s ease; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; outline: none; border: none; }

/* ================= NEUMORPHISM CORE ================= */
.neu-card { background: var(--bg); border-radius: 24px; box-shadow: 10px 10px 20px var(--shadow-dark), -10px -10px 20px var(--shadow-light); border: 1px solid var(--border); }
.neu-inset { background: var(--bg); border-radius: 16px; box-shadow: inset 5px 5px 10px var(--shadow-dark), inset -5px -5px 10px var(--shadow-light); }
.neu-button { background: var(--bg); color: var(--text); border-radius: 14px; padding: 12px 18px; font-weight: 700; cursor: pointer; box-shadow: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light); transition: all 0.2s ease; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; gap: 8px;}
.neu-button:hover { transform: translateY(-2px); }
.neu-button:active { box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light); transform: translateY(0); }
.btn-primary { color: var(--primary); }
.btn-danger { color: var(--danger); }

/* ================= AUTH PAGE (LOGIN & REGISTER) ================= */
/* FIX: Login page dibuat center sempurna tanpa merusak dashboard */
.auth-body { display: flex; align-items: center; justify-content: center; padding: 20px; min-height: 100vh;}
.auth-container { width: 100%; max-width: 420px; margin: auto; }
.auth-card { padding: 45px 35px; }
.brand-area { text-align: center; margin-bottom: 35px; }
/* BENTUK LAMA KITA ROMBAK TOTAL */
.logo-slot { 
    width: 100%; 
    max-width: 120px; /* Ukuran maksimal maskot di halaman Auth */
    height: auto; 
    margin: 0 auto 20px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    border-radius: 0; /* HAPUS BULETAN */
    background: transparent; /* Pastikan transparan */
}

/* CLASS BARU KHUSUS UNTUK TAG <img src="..."> MASKOT LU */
.mascot-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    /* Efek melayang dikit biar nyatu sama tema Neumorphism */
    filter: drop-shadow(0px 10px 10px rgba(0,0,0,0.15)); 
    transition: transform 0.3s ease;
}

.mascot-img:hover {
    transform: translateY(-5px); /* Animasi naik dikit pas disentuh mouse */
}
.brand-area h1 { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.brand-area p { font-size: 14px; color: var(--muted); }
.auth-panel { display: none; animation: fadeIn 0.4s ease; }
.auth-panel.active { display: block; }
.auth-switch { text-align: center; margin-top: 30px; font-size: 14px; color: var(--muted); }
.auth-switch span { color: var(--primary); font-weight: 800; cursor: pointer; transition: 0.2s; margin-left: 5px;}
.auth-switch span:hover { text-decoration: underline; }

/* FORMS & INPUTS */
input, textarea { width: 100%; padding: 16px 20px; color: var(--text); background: var(--bg); border-radius: 14px; box-shadow: inset 5px 5px 10px var(--shadow-dark), inset -5px -5px 10px var(--shadow-light); border:none; margin-bottom: 18px;}
label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px;}
.form-grid { display: flex; flex-direction: column; }

/* ================= DASHBOARD LAYOUT ================= */
.dashboard-body { display: flex; height: 100vh; overflow: hidden; padding: 20px; gap: 25px; }

/* SIDEBAR */
.sidebar { width: 290px; padding: 25px 20px; display: flex; flex-direction: column; flex-shrink: 0; height: calc(100vh - 40px); overflow-y: auto; transition: margin-left 0.4s ease; }
.sidebar::-webkit-scrollbar { display: none; }
.sidebar.collapsed-desktop { margin-left: -330px; opacity: 0; visibility: hidden; }

.sidebar-top { text-align: center; margin-bottom: 25px; }
/* CLASS KHUSUS MASKOT DI SIDEBAR DASHBOARD */
.sidebar-mascot {
    width: 100%;
    max-width: 90px; /* Di sidebar ukurannya lebih kecil biar rapi */
    height: auto;
    margin: 0 auto 15px;
    display: block;
}
.sidebar-profile { padding: 15px; margin-bottom: 20px; border-radius: 16px; }
.profile-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--shadow-dark); padding-bottom: 12px; }
.profile-header .avatar { width: 45px; height: 45px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: var(--primary); font-size: 20px; }
.profile-header .info strong { font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.profile-header .info small { color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: 0.5px;}
.profile-contact { font-size: 12px; color: var(--muted); font-weight: 600; }
.menu-label { font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: 1px; margin: 15px 0 10px 5px; text-transform: uppercase; }

.side-nav { flex-grow: 1; }
.side-nav > a { padding: 14px 18px; border-radius: 12px; font-weight: 600; color: var(--muted); transition: 0.3s; display: block; margin-bottom: 10px;}
.side-nav > a:hover, .side-nav > a.active { color: var(--primary); box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light); }
.sidebar-bottom { display: grid; gap: 12px; margin-top: 25px; padding-bottom: 15px;}

/* DROPDOWN MENU */
.dropdown-group { margin-bottom: 10px; }
.dropdown-btn { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; font-size: 13px; font-weight: 700; color: var(--text); border-radius: 12px; cursor: pointer; transition: 0.3s; border: none; outline: none; background: transparent;}
.dropdown-btn .arrow { font-size: 10px; transition: transform 0.3s ease; }
.dropdown-group.active .dropdown-btn { color: var(--primary); box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light); background: var(--bg);}
.dropdown-group.active .arrow { transform: rotate(180deg); }
.dropdown-content { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; display: flex; flex-direction: column; gap: 5px; padding: 0 10px; }
.dropdown-group.active .dropdown-content { max-height: 800px; padding: 10px 10px 5px 10px; }
.dropdown-item { background: transparent; padding: 10px 15px; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); border-radius: 8px; cursor: pointer; transition: 0.2s; border:none; display:block; width:100%;}
.dropdown-item:hover { color: var(--primary); background: var(--shadow-dark); }

/* MAIN CONTENT */
.main-content { flex-grow: 1; overflow-y: auto; padding-right: 10px; display: flex; flex-direction: column; gap: 20px; }
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 10px; }

.top-header { display: flex; align-items: center; justify-content: space-between; padding: 15px 25px; border-radius: 20px;}
.panel-section { padding: 30px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; border-bottom: 2px solid var(--shadow-dark); padding-bottom: 15px;}
.section-head h1 { font-size: 24px; font-weight: 800; margin-bottom: 5px;}
.section-head p { font-size: 14px; color: var(--muted);}

/* ðŸ”¥ FIX BADGE STATUS (DIJAMIN GAK NUMPUK & GAK TERPOTONG) ðŸ”¥ */
.status-badges { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.badge { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    gap: 6px; /* Jarak antara teks dan icon hijau/merah */
    padding: 10px 16px; 
    border-radius: 20px; 
    font-size: 11px; 
    font-weight: 800; 
    white-space: nowrap; 
    letter-spacing: 0.5px;
}

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.stat-card { padding: 25px; text-align: center; }
.stat-card h3 { font-size: 12px; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; font-weight: 800;}
.stat-card strong { font-size: 26px; color: var(--primary); font-weight: 800; }
.stat-card small { font-size: 13px; color: var(--muted); margin-left: 4px;}

.fade-in { animation: fadeIn 0.4s ease; }

/* MODAL RESULT */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 1000; backdrop-filter: blur(8px); }
.modal.show { display: flex; animation: fadeIn 0.2s; }
.modal-content { width: 100%; padding: 30px; border-radius: 24px;}

/* MOBILE RESPONSIVE */
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 998; opacity: 0; visibility: hidden; transition: 0.3s; backdrop-filter: blur(4px); }
.sidebar-backdrop.show { opacity: 1; visibility: visible; }

/* ================= HEADER ACTIONS & PROFILE DROPDOWN ================= */
.header-actions { display: flex; align-items: center; gap: 15px; }
.avatar-mini { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: var(--primary); font-size: 14px; }
.profile-dropdown-container { position: relative; }

.profile-menu { 
    position: absolute; 
    top: calc(100% + 15px); 
    right: 0; 
    width: 220px; 
    padding: 10px; 
    display: flex; 
    flex-direction: column; 
    opacity: 0; 
    visibility: hidden; 
    transform: translateY(-10px); 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    z-index: 1000;
}
.profile-menu.show { opacity: 1; visibility: visible; transform: translateY(0); }

.profile-menu-header { padding: 10px 12px; line-height: 1.5; }
.profile-menu-header strong { display: block; font-size: 14px; color: var(--primary); }
.profile-menu-header small { font-size: 11px; color: var(--muted); font-weight: 600; }

.profile-item { padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; transition: 0.2s; color: var(--text); text-decoration: none; }
.profile-item:hover { background: var(--shadow-dark); color: var(--primary); transform: translateX(5px); }
.profile-item.text-danger:hover { color: var(--danger); }

@media (max-width: 992px) {
    
    .dashboard-body { padding: 15px; display: block; overflow: auto; height: auto;}
    .main-content { padding-right: 0; overflow: visible;}
    .top-header { padding: 15px 20px; margin-bottom: 20px;}
    .top-header h2 { font-size: 16px !important; }
    .header-actions { gap: 10px; }
    .top-header { padding: 12px 15px; margin-bottom: 20px;}
    
    .section-head { flex-direction: column; align-items: flex-start; gap: 15px; }
    .status-badges { width: 100%; margin-top: 5px; justify-content: flex-start;}
    
    .sidebar { position: fixed; top: 0; left: -100%; height: 100vh; width: 290px; z-index: 999; margin: 0; border-radius: 0; transition: left 0.4s ease; padding-bottom: 40px;}
    .sidebar.open-mobile { left: 0; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
/* ================= FLOATING NOTIFICATION VVIP ================= */
.floating-notif {
    position: fixed !important;
    top: 30px !important;
    right: 30px !important;
    z-index: 999999 !important; /* Paksa tampil paling depan */
    min-width: 280px;
    padding: 16px 24px;
    border-radius: 16px;
    background: var(--bg);
    box-shadow: 10px 10px 20px var(--shadow-dark), -10px -10px 20px var(--shadow-light);
    border-left: 5px solid var(--primary); /* Garis warna di kiri */
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
    animation: slideInNotif 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.floating-notif.success { border-left-color: var(--success); }
.floating-notif.error { border-left-color: var(--danger); }

@keyframes slideInNotif {
    0% { transform: translateX(100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

/* 🔥 FIX UI MOBILE ULTIMATE (ANTI-BLEBER) */
@media (max-width: 768px) {
    
    /* ==========================================
       1. FIX SIDEBAR MENGGANTUNG DI BAWAH
       ========================================== */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important; /* Paksa nempel mentok bawah layar */
        height: auto !important; /* Buang 100vh biar gak bentrok sama browser HP */
        width: 270px !important;
        margin: 0 !important;
        border-radius: 0 20px 20px 0 !important;
        z-index: 9999 !important;
        overflow-y: auto !important;
        box-shadow: 15px 0 30px rgba(0,0,0,0.15) !important;
    }
    .sidebar-backdrop { z-index: 9998 !important; }

    /* ==========================================
       2. FIX TOMBOL TERMINAL BABLAS KANAN
       ========================================== */
    /* Target khusus bungkus tombol di atas terminal */
    #action-workspace .section-head > div:nth-child(2) {
        display: flex !important;
        flex-wrap: wrap !important; /* KUNCINYA: Paksa tombol turun ke baris baru kalau layar sempit */
        gap: 8px !important;
        width: 100% !important;
        justify-content: center !important;
    }

    /* Bikin tombol power otomatis menyesuaikan ukuran layar HP */
    #action-workspace .section-head button {
        flex: 1 1 calc(25% - 10px) !important; /* Tombol dibagi rata */
        padding: 8px 5px !important;
        font-size: 10px !important;
        white-space: nowrap !important;
    }

    /* Badge Live Sync dibikin full sebaris di bawah tombol */
    #terminal-status {
        flex: 1 1 100% !important;
        text-align: center !important;
        margin-top: 5px !important;
    }

    /* ==========================================
       3. FIX KOTAK TERMINAL DAN LAYOUT UTAMA
       ========================================== */
    #action-workspace .panel-section {
        padding: 15px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important; /* Tahan biar isi card gak jebol keluar */
    }

    #terminal-container {
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 10px !important;
        height: 350px !important;
        overflow-x: auto !important;
    }

    #terminal-content {
        font-size: 9px !important; /* Ukuran pas untuk HP */
        white-space: pre !important; 
    }
    
    .modal-content {
        width: 92% !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
        margin: auto !important;
    }
}
