/* ================= VARIABLES & RESET ================= */
:root {
    --primary: #0288D1; 
    --primary-dark: #01579B; 
    --primary-light: #E1F5FE; 
    --success: #10b981; 
    --success-light: #d1fae5; 
    --danger: #ef4444; 
    --danger-light: #fee2e2; 
    --warning: #f59e0b; 
    --warning-light: #fef3c7; 
    --bg-body: #f8fafc; 
    --card-bg: #ffffff;
    --text-primary: #0f172a; 
    --text-secondary: #475569; 
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --radius: 16px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

body.dark-mode {
    --bg-body: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --primary-light: #0c4a6e;
    --success-light: #064e3b;
    --danger-light: #7f1d1d;
    --warning-light: #78350f;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }
body { background-color: var(--bg-body); color: var(--text-primary); transition: background 0.3s, color 0.3s; -webkit-tap-highlight-color: transparent; }

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-gray { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 700; }
.fs-small { font-size: 0.85rem; }
.fs-xs { font-size: 0.75rem; }
.mt-1 { margin-top: 8px; } .mb-1 { margin-bottom: 8px; }
.mt-2 { margin-top: 16px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .gap-1 { gap: 8px; }
.w-full { width: 100%; }

/* ================= LOGIN SCREEN ================= */
.login-container { min-height: 100vh; display: flex; justify-content: center; align-items: center; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); padding: 20px; }
.login-card { background: var(--card-bg); border-radius: 24px; padding: 40px 30px; width: 100%; max-width: 400px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); }
.splash-logo-img { width: 100px; height: auto; animation: swim 3s ease-in-out infinite; }
@keyframes swim { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.divider { display: flex; align-items: center; text-align: center; margin: 20px 0; color: var(--text-muted); font-size: 0.8rem; }
.divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border-color); }
.divider span { padding: 0 10px; }
.guest-actions { border-top: 1px solid var(--border-color); margin-top: 24px; padding-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.link-primary { color: var(--primary); text-decoration: none; transition: 0.2s; }
.link-primary:hover { opacity: 0.8; }

/* ================= APP LAYOUT ================= */
.app-container { max-width: 800px; margin: 0 auto; min-height: 100vh; position: relative; background: var(--bg-body); display: flex; flex-direction: column; }
.header { background: var(--card-bg); color: var(--text-primary); padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm); border-bottom: 1px solid var(--border-color); }
.app-icon { background: var(--primary); color: white; width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.header-icon { background: var(--bg-body); border: none; color: var(--text-secondary); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.header-icon:active { transform: scale(0.9); }
.btn-logout { color: var(--danger); background: var(--danger-light); }

.user-pill { display: flex; align-items: center; gap: 8px; background: var(--bg-body); padding: 6px 14px 6px 6px; border-radius: 20px; cursor: pointer; border: 1px solid var(--border-color); }
.user-avatar { width: 26px; height: 26px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; }

.content-area { flex: 1; overflow-y: auto; padding: 16px 16px 90px; }
.section { display: none; animation: fadeIn 0.3s ease; }
.section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ================= BOTTOM NAV ================= */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card-bg); display: flex; padding: 10px 5px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 20px rgba(0,0,0,0.06); z-index: 100; border-top: 1px solid var(--border-color); max-width: 800px; margin: 0 auto; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-muted); cursor: pointer; transition: 0.2s; padding: 6px 0; }
.nav-item i { font-size: 1.25rem; }
.nav-item span { font-size: 0.65rem; font-weight: 500; }
.nav-item.active { color: var(--primary); }
.nav-item.active i { transform: translateY(-3px); }
.nav-item.active span { font-weight: 700; }

/* ================= UI COMPONENTS ================= */
.card { background: var(--card-bg); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); transition: background 0.3s; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 600; font-size: 0.95rem; }

.btn { padding: 12px 18px; border: none; border-radius: 12px; font-size: 0.9rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s; width: 100%; letter-spacing: 0.3px; }
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(2, 136, 209, 0.3); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: #78350f; }
.btn-outline { background: transparent; border: 1.5px solid var(--border-color); color: var(--text-primary); }
.btn-sm { padding: 8px 14px; font-size: 0.8rem; width: auto; }

.badge { padding: 4px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; color: white; display: inline-block; }
.badge-success { background: var(--success); }
.badge-warning { background: var(--warning); color: #78350f; }
.badge-danger { background: var(--danger); }
.badge-primary { background: var(--primary); }

.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.form-control { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border-color); border-radius: 12px; font-size: 0.95rem; background: var(--bg-body); color: var(--text-primary); transition: border 0.2s; outline: none; }
.form-control:focus { border-color: var(--primary); background: var(--card-bg); box-shadow: 0 0 0 3px rgba(2, 136, 209, 0.1); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

/* Menu Grid Khusus (Mirip Aplikasi Finansial) */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.menu-item { background: var(--card-bg); border-radius: var(--radius); padding: 20px 10px; text-align: center; cursor: pointer; box-shadow: var(--shadow-sm); border: 1.5px solid transparent; transition: 0.2s; display: flex; flex-direction: column; align-items: center; justify-content: center;}
.menu-item:active { transform: scale(0.95); }
.menu-item i { font-size: 1.8rem; color: var(--primary); margin-bottom: 10px; }
.menu-item .title { font-weight: 600; font-size: 0.8rem; color: var(--text-primary); }
.menu-item small { font-size: 0.65rem; color: var(--text-muted); margin-top: 4px; }

/* ================= MODAL (BOTTOM SHEET STYLE) ================= */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; align-items: flex-end; justify-content: center; backdrop-filter: blur(3px); }
.modal.active { display: flex; animation: fadeBg 0.3s; }
@keyframes fadeBg { from { background: rgba(0,0,0,0); } to { background: rgba(0,0,0,0.5); } }

.modal-content { background: var(--card-bg); border-radius: 24px 24px 0 0; width: 100%; max-width: 600px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 -10px 40px rgba(0,0,0,0.2); animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; position: relative; }
/* Indikator "tarik" khas bottom sheet */
.modal-header::before { content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 40px; height: 4px; background: var(--border-color); border-radius: 4px; }
.modal-header h3 { font-size: 1.1rem; color: var(--text-primary); }
.modal-close { background: var(--bg-body); border: none; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); transition: 0.2s; }
.modal-close:active { background: var(--danger-light); color: var(--danger); }

.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 12px; background: var(--card-bg); }

/* Notifikasi / Toast */
.notif { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #334155; color: white; padding: 12px 24px; border-radius: 30px; z-index: 1100; font-size: 0.9rem; font-weight: 500; box-shadow: 0 10px 25px rgba(0,0,0,0.2); animation: slideDown 0.3s ease; white-space: nowrap; max-width: 90%; }
@keyframes slideDown { from { top: -50px; opacity: 0; } to { top: 20px; opacity: 1; } }
.notif.success { background: var(--success); }
.notif.danger { background: var(--danger); }
.notif.info { background: var(--primary); }
.notif.warning { background: var(--warning); color: #78350f; }

#demoWatermark { display: none; position: fixed; top: 80px; right: -30px; background: var(--danger); color: white; padding: 4px 40px; font-size: 0.7rem; font-weight: 700; z-index: 1050; transform: rotate(45deg); pointer-events: none; box-shadow: 0 2px 10px rgba(0,0,0,0.2); text-transform: uppercase; letter-spacing: 1px; }

/* Responsif Mobile Khusus Menu Grid */
@media(max-width: 480px){
    .menu-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .card { padding: 14px; }
}
/* ================= UX UPGRADES (10/10) ================= */
/* 1. Empty States (Tampilan Kosong) */
.empty-state { text-align: center; padding: 50px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: transparent; border: none; box-shadow: none; }
.empty-state i { font-size: 5rem; color: var(--border-color); margin-bottom: 20px; }
.empty-state h3 { color: var(--text-primary); margin-bottom: 8px; font-size: 1.2rem; font-weight: 700; }
.empty-state p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 24px; max-width: 280px; line-height: 1.5; }

/* 2. Inline Validation (Garis Merah & Getar) */
.form-control.input-error, .form-control.input-error:focus { 
    border-color: var(--danger) !important; 
    background: var(--danger-light) !important; 
    animation: shakeError 0.4s; 
}
@keyframes shakeError { 
    0%, 100% {transform: translateX(0);} 
    25% {transform: translateX(-6px);} 
    75% {transform: translateX(6px);} 
}

/* 3. Fullscreen Modal (Khusus Form Panjang biar lega) */
.modal-fullscreen .modal-content { height: 100vh; max-height: 100vh; border-radius: 0; display: flex; flex-direction: column; }
.modal-fullscreen .modal-body { flex: 1; padding-bottom: 120px; }
.modal-fullscreen .modal-header { padding-top: calc(16px + env(safe-area-inset-top)); }
/* ================= UX PREMIUM: FLOATING ACTION BUTTON (FAB) ================= */
.fab-container {
    position: fixed;
    bottom: 90px; /* Melayang tepat di atas bottom nav */
    right: 20px;
    z-index: 999; 
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 15px;
}

.fab-main {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 6px 20px rgba(2, 136, 209, 0.4);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-main:active {
    transform: scale(0.9);
}

/* Animasi tombol utama saat menu mini terbuka */
.fab-main.active {
    background: var(--danger);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    transform: rotate(45deg); /* Ikon plus berputar jadi silang */
}

/* Wadah tombol-tombol kecil */
.fab-mini-container {
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    pointer-events: none; /* Biar nggak ngeblok layar kalau lagi tutup */
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
}

/* Saat dibuka */
.fab-mini-container.show {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
}

/* Bentuk tombol kecilnya */
.fab-mini {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.fab-mini:active {
    transform: scale(0.9);
}

/* Tooltip kecil tulisan di sebelah kiri tombol */
.fab-mini::after {
    content: attr(title);
    position: absolute;
    right: 60px;
    background: var(--text-primary);
    color: var(--card-bg);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.fab-mini:hover::after {
    opacity: 1;
}

/* ================= UX PREMIUM: FLOATING ACTION BUTTON (FAB) ================= */
.fab-container {
    position: fixed;
    bottom: 90px; 
    right: 20px;
    z-index: 999; 
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 15px;
}

.fab-main {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 6px 20px rgba(2, 136, 209, 0.4);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.fab-main:active { transform: scale(0.9); }
.fab-main.active {
    background: var(--danger);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    transform: rotate(45deg); 
}

.fab-mini-container {
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    pointer-events: none; 
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
}
.fab-mini-container.show {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
}

.fab-mini {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}
.fab-mini:active { transform: scale(0.9); }

.fab-mini::after {
    content: attr(title);
    position: absolute;
    right: 60px;
    background: var(--text-primary);
    color: var(--card-bg);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.fab-mini:hover::after { opacity: 1; }
/* ================= UX PREMIUM: SPEEDOMETER GAUGE ================= */
.gauge-wrapper {
    width: 120px;
    height: 70px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}

.gauge-svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.05));
}

.gauge-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 12;
    stroke-linecap: round;
}

.gauge-fill {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.5s ease;
}
.gauge-wrapper { width: 120px; height: 70px; margin: 0 auto; overflow: hidden; position: relative; }
.gauge-svg { width: 100%; height: auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.05)); }
.gauge-bg { fill: none; stroke: var(--border-color); stroke-width: 12; stroke-linecap: round; }
.gauge-fill { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.5s ease; }
/* ================= UX PREMIUM: ACCORDION ENSIKLOPEDIA ================= */
.accordion-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s;
}

.accordion-header {
    padding: 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.accordion-header:active {
    background: var(--bg-body);
}

.accordion-icon {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-body {
    max-height: 0; /* Awalnya tertutup rapat */
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 16px;
}

.accordion-body p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}