:root {
    --bg-color: #0a0e27;
    --card-bg: rgba(20, 24, 45, 0.7);
    --border-color: rgba(60, 64, 90, 0.5);
    
    --neon-green: #00ff88;
    --neon-cyan: #00bfff;
    --neon-purple: #d946ef;
    --neon-red: #ef4444;
    --neon-orange: #f97316;
    
    --text-main: #f0f0f5;
    --text-dim: #8b8b9e;
}

body.light-mode {
    --bg-color: #ffffff;              /* Background Putih Bersih */
    --card-bg: #f1f5f9;               /* Elemen Abu-abu Terang (Slate-100) */
    --border-color: #cbd5e1;          /* Border Abu-abu (Slate-300) */

    --neon-green: #059669;            /* Warna aksen lebih deep untuk kontras */
    --neon-cyan: #0284c7;
    --neon-purple: #7c3aed;
    --neon-red: #dc2626;
    --neon-orange: #ea580c;

    --text-main: #0f172a;             /* Teks Gelap (Slate-900) */
    --text-dim: #475569;              /* Teks Abu (Slate-600) */
}

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

body {
    background-color: transparent; /* Kontrol diserahkan ke sistem partikel */
    color: var(--text-main);
    font-family: 'Oswald', 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

#particles-js {
    position: fixed; width: 100%; height: 100%;
    top: 0; left: 0; z-index: -1;
    background-color: var(--bg-color);
    transition: background-color 0.5s ease;
}

.app-container { padding: 1rem; max-width: 600px; margin: 0 auto; position: relative; z-index: 1; }

/* Typography */
.neon-title {
    color: var(--neon-green);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
    font-size: 1.6rem;
    font-weight: 800;
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--neon-green);
    animation: typing 7s steps(22, end) infinite, blinkCaret 0.8s step-end infinite;
    padding-right: 5px; /* Spasi untuk kursor */
}
.neon-title .dim { color: var(--neon-cyan); font-weight: 500; }

@keyframes typing {
    0% { width: 0; }
    30% { width: 19ch; } /* Huruf selesai diketik */
    70% { width: 19ch; } /* Jeda diam sebelum dihapus */
    100% { width: 0; } /* Dihapus perlahan ke belakang */
}

@keyframes blinkCaret {
    from, to { border-color: transparent; }
    50% { border-color: var(--neon-green); box-shadow: 2px 0 5px var(--neon-green); }
}

h2.card-title { font-size: 1.1rem; margin-bottom: 1rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }

.text-cyan { color: var(--neon-cyan); }
.text-green { color: var(--neon-green); }
.text-center { text-align: center; }

/* Layout & Cards */
.content-scroll { display: flex; flex-direction: column; gap: 1.5rem; padding-top: 1rem; padding-bottom: 5rem; }
.dashboard-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Tab Views */
.tab-view { animation: fadeIn 0.3s ease-in-out; }
.tab-view.hidden { display: none !important; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.stat-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.1rem;
    display: flex; flex-direction: column; align-items: center;
    backdrop-filter: blur(8px);
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.1);
}

.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
}
.stat-card:nth-child(1)::before { background: var(--neon-green); box-shadow: 0 0 15px var(--neon-green); }
.stat-card:nth-child(2)::before { background: var(--neon-cyan); box-shadow: 0 0 15px var(--neon-cyan); }
.stat-card:nth-child(3)::before { background: var(--neon-purple); box-shadow: 0 0 15px var(--neon-purple); }

.stat-card::after {
    content: ''; position: absolute; top: -20px; left: 0; right: 0; height: 3px;
    background: var(--neon-cyan); box-shadow: 0 0 15px var(--neon-cyan), 0 0 5px #fff;
    animation: statScanline 2.5s linear infinite; opacity: 0;
}

@keyframes statScanline {
    0% { transform: translateY(0); opacity: 0; }
    15% { opacity: 0.8; }
    85% { opacity: 0.8; }
    100% { transform: translateY(90px); opacity: 0; }
}

.stat-label { 
    font-size: 0.55rem; color: var(--text-dim); margin-bottom: 0.2rem; 
    display: flex; align-items: center; gap: 0.2rem; letter-spacing: 1px; 
}
.stat-label i { font-size: 0.7rem; color: var(--neon-cyan); opacity: 0.8; }
.stat-value { font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 0.25rem; font-family: 'Oswald', sans-serif; letter-spacing: 1px; }
.stat-value.active { color: var(--neon-green); text-shadow: 0 0 10px var(--neon-green); }
.stat-value.lines { color: var(--neon-cyan); text-shadow: 0 0 10px var(--neon-cyan); }
.stat-value.rate { color: var(--neon-purple); text-shadow: 0 0 10px var(--neon-purple); }

/* Charts Area */
.chart-container { width: 100%; height: 180px; position: relative; }

/* Buttons Forms & Inputs */
.action-btn {
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 1.15rem 1rem; border-radius: 8px; font-weight: 600; cursor: pointer;
    font-family: inherit; transition: all 0.3s ease; background: transparent; color: white;
}
.outline-btn { border: 1px solid var(--neon-green); color: var(--neon-green); }
.outline-btn:hover { background: rgba(0, 255, 136, 0.1); }
.purple-outline { border: 1px solid var(--neon-purple); color: var(--neon-purple); }
.purple-outline:hover { background: rgba(217, 70, 239, 0.1); }
.primary-btn { background: var(--neon-purple); color: #fff; border: none; box-shadow: 0 0 10px rgba(217, 70, 239, 0.5); }
.red-btn { background: var(--neon-red); color: white; border: none; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.mt-4 { margin-top: 1rem; } .mb-2 { margin-bottom: 0.5rem; } .w-full { width: 100%; }

.form-group { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.3rem;}
.form-group label { font-size: 0.8rem; color: var(--text-dim); }
.smart-input, .form-select, .form-textarea, .form-date {
    width: 100%; padding: 0.75rem 1rem; background: rgba(10, 14, 39, 0.5);
    border: 1px solid var(--neon-cyan); border-radius: 8px; color: white;
    font-family: inherit; outline: none; transition: box-shadow 0.3s ease;
}
.smart-input:focus, .form-select:focus, .form-textarea:focus { box-shadow: 0 0 15px rgba(0, 191, 255, 0.2); }

/* Navigation */
.floating-nav {
    position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%);
    background: rgba(10, 14, 30, 0.85); backdrop-filter: blur(15px);
    border-radius: 12px; padding: 0.5rem 1.5rem; 
    border: 1px solid rgba(0, 191, 255, 0.2);
    border-top: 2px solid var(--neon-cyan);
    border-bottom: 2px solid var(--neon-purple);
    box-shadow: 0 15px 35px rgba(0,0,0,0.6), inset 0 2px 10px rgba(0, 191, 255, 0.2), inset 0 -2px 10px rgba(217, 70, 239, 0.2);
    z-index: 100;
}
.light-mode .floating-nav {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(200, 205, 220, 0.5);
    border-top: 2px solid var(--neon-cyan);
    border-bottom: 2px solid var(--neon-purple);
}
.nav-container { display: flex; align-items: center; gap: 1.8rem; }
.nav-item {
    background: none; border: none; color: var(--neon-cyan); font-size: 1.6rem;
    cursor: pointer; padding: 0.3rem; position: relative; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.nav-item:hover { 
    color: var(--neon-red); 
    text-shadow: 0 0 15px var(--neon-red);
    transform: scale(1.15) translateY(-3px); 
}
.nav-item.active { 
    color: var(--neon-cyan); text-shadow: 0 0 15px var(--neon-cyan); 
    transform: translateY(-8px); 
}
.nav-item.active::after {
    content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
    width: 6px; height: 6px; border-radius: 50%; background: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan);
}

/* Futuristic Cyber Buttons */
.cyber-back {
    position: relative;
    width: 38px; height: 38px;
    border-radius: 6px;
    background: rgba(10, 14, 30, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-dim);
    display: flex; justify-content: center; align-items: center;
    font-size: 1.4rem; cursor: pointer;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
}
.cyber-back:hover {
    transform: translateX(-4px); /* Efek melesat ke kiri */
    border-color: var(--neon-cyan); color: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan), inset 0 0 5px var(--neon-cyan);
    background: rgba(0, 191, 255, 0.1);
}
.light-mode .cyber-back {
    background: rgba(255,255,255,0.8);
    color: var(--neon-purple); border-color: rgba(200, 205, 220, 0.8);
}
.light-mode .cyber-back:hover { border-color: var(--neon-purple); }

/* Futuristic Theme Toggle */
.cyber-toggle {
    position: relative;
    width: 40px; height: 40px;
    border-radius: 8px; /* Boxy sci-fi geometry */
    background: rgba(10, 14, 30, 0.6);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    display: flex; justify-content: center; align-items: center;
    font-size: 1.5rem; cursor: pointer; z-index: 10;
    box-shadow: 0 0 10px rgba(0, 191, 255, 0.3), inset 0 0 5px rgba(0, 191, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.cyber-toggle::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: var(--neon-purple); box-shadow: 0 0 5px var(--neon-purple);
    animation: statScanline 2.5s linear infinite; opacity: 0.6; pointer-events: none;
}
.cyber-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    border-color: var(--neon-green); color: var(--neon-green);
    box-shadow: 0 0 15px var(--neon-green), inset 0 0 10px var(--neon-green);
}
.light-mode .cyber-toggle {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--neon-purple); color: var(--neon-purple);
    box-shadow: 0 0 10px rgba(147, 51, 234, 0.3);
}
.light-mode .cyber-toggle::before { background: var(--neon-cyan); box-shadow: 0 0 5px var(--neon-cyan); }

/* The Scan Button */
.scan-btn {
    width: 65px; height: 65px; background: rgba(10, 14, 30, 0.9); border-radius: 15px;
    display: flex; align-items: center; justify-content: center; color: var(--neon-purple); font-size: 2.2rem;
    border: 2px solid var(--neon-purple); 
    box-shadow: 0 0 15px rgba(217, 70, 239, 0.4), inset 0 0 15px rgba(217, 70, 239, 0.3);
    transform: translateY(-25px) rotate(45deg); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.scan-btn i { transform: rotate(-45deg); }
.scan-btn:hover {
    transform: translateY(-30px) rotate(45deg) scale(1.1);
    box-shadow: 0 0 25px var(--neon-purple), inset 0 0 20px var(--neon-purple);
    color: var(--neon-purple); /* Mencegah warna merah dari nav-item bocor ke tombol canggih ini */
}
.light-mode .scan-btn { background: rgba(255,255,255,0.9); box-shadow: 0 0 15px rgba(147, 51, 234, 0.3), inset 0 0 10px rgba(147, 51, 234, 0.2); }

/* Modals */
.hidden { display: none !important; }
.modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(5px);
    z-index: 1000; display: flex; justify-content: center; align-items: center;
}
.modal-content {
    background: var(--bg-color); border: 1px solid var(--neon-purple);
    width: 95%; max-width: 500px; max-height: 90vh; overflow-y: auto;
    border-radius: 12px; padding: 1.2rem; box-shadow: 0 0 30px rgba(217, 70, 239, 0.15);
}
.modal-header { display: flex; justify-content: space-between; margin-bottom: 1rem; color: var(--neon-purple); align-items: center; }
.modal-header button { background: none; border: none; font-size: 1.5rem; color: #fff; cursor: pointer; }

/* Tables */
.table-responsive { 
    width: 100%; 
    overflow-x: auto; 
    margin-top: 1rem; 
    border-radius: 8px; 
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch; /* Smooth scrolling di iOS */
}
#dashboardTableArea table { font-size: 0.75rem; } /* Font lebih kecil di dashboard */
#dashboardTableArea th, #dashboardTableArea td { padding: 0.5rem 0.35rem; } /* Padding lebih rapat */
#dashboardTableArea th:nth-child(2), #dashboardTableArea td:nth-child(2) { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* Limbat Style */
#dashboardTableArea th:nth-child(3), #dashboardTableArea td:nth-child(3) { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* Limbat Proses */

table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.85rem; }
th { background: rgba(0, 191, 255, 0.1); color: var(--neon-cyan); padding: 0.75rem; border-bottom: 1px solid var(--neon-cyan); }
td { padding: 0.75rem; border-bottom: 1px solid var(--border-color); }
tr:last-child td { border-bottom: none; }
tr:hover { background: rgba(255,255,255,0.02); }

.badge { padding: 0.2rem 0.5rem; border-radius: 12px; font-size: 0.7rem; font-weight: bold; }
.badge.bg-green { background: rgba(0, 255, 136, 0.2); color: var(--neon-green); border: 1px solid var(--neon-green); }
.badge.bg-blue { background: rgba(0, 191, 255, 0.2); color: var(--neon-cyan); border: 1px solid var(--neon-cyan); }
.badge.bg-red { background: rgba(239, 68, 68, 0.2); color: var(--neon-red); border: 1px solid var(--neon-red); }
.badge.bg-orange { background: rgba(249, 115, 22, 0.2); color: var(--neon-orange); border: 1px solid var(--neon-orange); }

/* Notifications */
.toast-container { position: fixed; top: 2rem; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 0.8rem; align-items: center; }
.toast {
    padding: 0.8rem 1.5rem; border-radius: 50px; color: white; display: flex; align-items: center; gap: 0.8rem;
    animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; 
    font-size: 0.9rem; font-weight: 500; letter-spacing: 0.5px;
    background: rgba(10, 14, 30, 0.85); backdrop-filter: blur(10px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    white-space: nowrap;
    transition: opacity 0.3s ease;
}
.toast-info { border: 1px solid var(--neon-cyan); box-shadow: 0 0 15px rgba(0, 191, 255, 0.2); }
.toast-success { border: 1px solid var(--neon-green); box-shadow: 0 0 15px rgba(0, 255, 136, 0.2); }
.toast-error { border: 1px solid var(--neon-red); box-shadow: 0 0 15px rgba(239, 68, 68, 0.2); }
@keyframes slideDown { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* OCR Camera Additions */
.camera-lens { position: relative; width: 100%; height: 250px; background: #000; border-radius: 8px; overflow: hidden; }
#cameraFeed { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 60%; height: 18%; border: 2px dashed rgba(217, 70, 239, 0.8); box-shadow: 0 0 0 9999px rgba(0,0,0,0.5); pointer-events: none; }
.scan-actions { margin-top: 1rem; display: flex; justify-content: center; }
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(217, 70, 239, 0.7); } 70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(217, 70, 239, 0); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(217, 70, 239, 0); } }
.ocr-result-box textarea { width: 100%; background: #1a1a2e; color: #0f9; padding: 0.5rem; border: 1px solid var(--neon-green); border-radius: 4px; margin-top: 0.5rem; }
.loading-state { text-align: center; color: var(--neon-cyan); margin-top: 1rem; }
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Utility */
.blink { animation: blinker 1s linear infinite; }
@keyframes blinker { 50% { opacity: 0; } }
.status-dot { display: inline-block; width: 8px; height: 8px; background-color: var(--neon-purple); border-radius: 50%; margin-right: 5px; box-shadow: 0 0 5px var(--neon-purple);}

/* ==========================
   MOBILE RESPONSIVENESS
========================== */
@media screen and (max-width: 768px) {
    /* Floating Action Bar - Mobile Scale */
    .floating-nav {
        width: 90%; max-width: 380px; 
        padding: 0.4rem 0.8rem;
        border-radius: 12px;
        bottom: 1.5rem;
    }
    .nav-container { justify-content: space-between; width: 100%; gap: 0.8rem; }
    
    .nav-item { font-size: 1.3rem; padding: 0.2rem; }
    .nav-item.active { transform: translateY(-5px); }
    .nav-item.active::after { bottom: -8px; width: 5px; height: 5px; }

    /* The Center Mech Button - Mobile Scale */
    .scan-btn {
        width: 50px; height: 50px; 
        font-size: 1.7rem; border-radius: 10px;
        transform: translateY(-20px) rotate(45deg);
    }
    .scan-btn:hover {
        transform: translateY(-25px) rotate(45deg) scale(1.05);
    }
    
    /* Header & General Scale */
    .neon-title { font-size: 1.4rem; }
    .cyber-toggle { width: 34px; height: 34px; font-size: 1.2rem; }
    .cyber-back { width: 32px; height: 32px; font-size: 1.1rem; }
    
    /* Metrics Grid */
    .stats-grid { gap: 0.5rem; }
    .stat-label { font-size: 0.65rem; }
    .stat-value { font-size: 1.2rem; }
    .dashboard-card { padding: 1rem; }
    .chart-container { height: 180px; }
}

/* Light Mode cleanup for Gray Theme */
.light-mode .app-container { z-index: 2; }
.light-mode .neon-title { border-right-color: #0f172a; color: #0f172a; text-shadow: none; }
.light-mode .neon-title .dim { color: var(--neon-cyan); }
.light-mode .stat-label { color: var(--text-dim); }
.light-mode .dashboard-card, .light-mode .stat-card, .light-mode .action-btn, 
.light-mode .smart-input, .light-mode .form-select, .light-mode .form-textarea, .light-mode .form-date { 
    backdrop-filter: none; 
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); 
}
.light-mode .floating-nav { background: rgba(255,255,255,0.9); border-color: #cbd5e1; }
.light-mode .nav-card-btn { background: var(--card-bg); color: var(--text-main); }
.light-mode .form-group label { color: #334155; font-weight: 600; }
.light-mode .nav-item { color: #64748b; }
.light-mode .nav-item.active { color: var(--neon-purple); }

/* ==========================
   🖥️ DESKTOP MODE OVERRIDES
   ========================== */
body.desktop-mode .app-container {
    max-width: 1300px;
    padding: 1rem 2rem;
}

/* Sembunyikan FAB di Desktop sesuai permintaan */
body.desktop-mode .floating-nav {
    display: none !important;
}

/* Dashboard Grid: Susunan kartu lebih rapi */
body.desktop-mode #view-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Elemen yang melebar penuh (Full Width) */
body.desktop-mode #view-dashboard > .search-container,
body.desktop-mode #view-dashboard > .stats-grid,
body.desktop-mode #view-dashboard > section:last-of-type,
body.desktop-mode .desktop-nav-panel {
    grid-column: span 2;
}

/* Panel Navigasi Desktop (Ganti FAB) */
.desktop-nav-panel {
    display: none; /* Sembunyikan di Mobile */
}

body.desktop-mode .desktop-nav-panel {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.nav-card-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-main);
    backdrop-filter: blur(10px);
}

.nav-card-btn i {
    font-size: 2rem;
    color: var(--neon-cyan);
    transition: all 0.3s ease;
}

.nav-card-btn span {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-dim);
}

.nav-card-btn:hover {
    border-color: var(--neon-purple);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(217, 70, 239, 0.15);
    background: rgba(217, 70, 239, 0.05);
}

.nav-card-btn:hover i {
    color: var(--neon-purple);
    text-shadow: 0 0 15px var(--neon-purple);
}

.nav-card-btn:hover span {
    color: var(--text-main);
}

/* Modal & Tabel lebih lega */
body.desktop-mode .modal-content {
    max-width: 90%;
    width: 1150px;
}

body.desktop-mode table {
    font-size: 0.95rem;
}

body.desktop-mode .table-responsive {
    max-height: 70vh;
    overflow-y: auto;
}

body.desktop-mode th {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #14182d !important; /* Solid Dark agar tidak tembus pandang */
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

body.light-mode.desktop-mode th {
    background: #f1f5f9 !important; /* Solid Gray untuk mode terang */
}
