/* ============================================================
   STYLE UTAMA — Admin Panel
   Mendukung tema Terang (light) dan Gelap (dark)
   ============================================================ */

/* ---- CSS Variables / Design Tokens ---- */
:root {
    /* Warna utama */
    --primary:       #4361ee;
    --primary-dark:  #3a52d4;
    --primary-light: #eef0fd;
    --accent:        #f72585;

    /* Sidebar */
    --sidebar-w:     260px;
    --sidebar-bg:    #1a1f2e;
    --sidebar-text:  #a0aec0;
    --sidebar-active:#ffffff;
    --sidebar-hover: rgba(255,255,255,0.07);
    --sidebar-accent:#4361ee;

    --sidebar-bg:    #ffffff;
    --sidebar-text:  #64748b;
    --sidebar-active:#1a202c;
    --sidebar-hover: rgba(0,0,0,0.04);
    --sidebar-accent:#4361ee;

    /* Layout */
    --topbar-h:      60px;
    --radius:        10px;
    --shadow:        0 2px 12px rgba(0,0,0,0.08);
    --shadow-md:     0 4px 24px rgba(0,0,0,0.12);
    --transition:    0.25s ease;

    /* Tema Terang */
    --bg:            #f0f2f8;
    --surface:       #ffffff;
    --surface-2:     #f8f9fc;
    --border:        #e2e8f0;
    --text:          #1a202c;
    --text-muted:    #718096;
    --text-light:    #a0aec0;

    /* Status warna */
    --success:       #10b981;
    --warning:       #f59e0b;
    --danger:        #ef4444;
    --info:          #3b82f6;
}

/* ---- Tema Gelap ---- */
[data-theme="dark"] {
    --bg:            #0f1117;
    --surface:       #1a1f2e;
    --surface-2:     #252b3b;
    --border:        #2d3450;
    --text:          #e2e8f0;
    --text-muted:    #8892a4;
    --text-light:    #5a6478;
    --shadow:        0 2px 12px rgba(0,0,0,0.3);
    --shadow-md:     0 4px 24px rgba(0,0,0,0.4);
    --primary-light: rgba(67,97,238,0.15);

    --sidebar-bg:    #0d1117;
    --sidebar-hover: rgba(255,255,255,0.05);

    --sidebar-bg:    #0d1117;
    --sidebar-text:  #a0aec0;
    --sidebar-active:#ffffff;
    --sidebar-hover: rgba(255,255,255,0.05);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    transition: background var(--transition), color var(--transition);
    /* Proteksi copy-paste */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Izinkan seleksi di dalam tabel dan input */
table, input, textarea, select { user-select: text; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   LAYOUT UTAMA
   ============================================================ */
#app {
    display: flex;
    min-height: 100vh;
}

/* ---- SIDEBAR ---- */
#sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 200;
    transition: width var(--transition), transform var(--transition);
    overflow: hidden;
border-right: 1px solid var(--border);
}

#sidebar.collapsed {
    width: 0;
}

/* Sidebar brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    white-space: nowrap;
    min-width: var(--sidebar-w);
}

.sidebar-brand .brand-icon {
    width: 36px; height: 36px;
    /*background: var(--primary);*/
    background: #fff;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.sidebar-brand .brand-name {
    font-size: 15px;
    font-weight: 700;
    /*color: #fff;*/
    letter-spacing: 0.3px;
}

/* Sidebar menu */
.sidebar-menu {
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-track { background: transparent; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.menu-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    padding: 14px 18px 6px;
    white-space: nowrap;
    min-width: var(--sidebar-w);
}

/* Item menu */
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: var(--sidebar-text);
    cursor: pointer;
    border-radius: 0;
    transition: all 0.18s;
    white-space: nowrap;
    min-width: var(--sidebar-w);
    position: relative;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: var(--sidebar-hover);
    /*color: #fff;*/
color: var(--sidebar-active);
}

.menu-item.active {
    background: rgba(67,97,238,0.2);
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-accent);
}

.menu-item .menu-icon {
    font-size: 17px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.menu-item .menu-text {
    flex: 1;
    font-size: 13.5px;
    font-weight: 500;
}

.menu-item .menu-badge {
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
}

.menu-item .menu-arrow {
    font-size: 11px;
    transition: transform var(--transition);
    opacity: 0.6;
}

.menu-item.open > .menu-arrow {
    transform: rotate(90deg);
}

/* Sub-menu */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0,0,0,0.15);
}

.submenu.open {
    max-height: 400px;
}

.submenu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px 9px 52px;
    color: var(--sidebar-text);
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    min-width: var(--sidebar-w);
    transition: all 0.18s;
    border-left: 3px solid transparent;
    /*background: #fff;*/
}


.submenu-item:hover {
    background: var(--sidebar-hover);
    /*color: #fff;*/
color: var(--sidebar-active);
}

.submenu-item.active {
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-accent);
}

.submenu-item::before {
    content: '›';
    font-size: 14px;
    opacity: 0.5;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    min-width: var(--sidebar-w);
}

.sidebar-footer .avatar {
    width: 34px; height: 34px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.sidebar-footer .user-info .name {
    font-size: 12.5px;
    font-weight: 600;
    /*color: #fff;*/
}

.sidebar-footer .user-info .role {
    font-size: 11px;
    color: var(--sidebar-text);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
#main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
}

#main.full {
    margin-left: 0;
}

/* ---- TOPBAR ---- */
#topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    transition: background var(--transition), border-color var(--transition);
}

.topbar-toggle {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border: none;
    background: var(--surface-2);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text);
    font-size: 18px;
    transition: background 0.18s;
    flex-shrink: 0;
}

.topbar-toggle:hover { background: var(--border); }

.topbar-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-btn {
    width: 36px; height: 36px;
    border: none;
    background: var(--surface-2);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.18s;
    position: relative;
}

.topbar-btn:hover {
    background: var(--border);
    color: var(--text);
}

/* Tombol tema */
#themeToggle { font-size: 17px; }

/* ---- PAGE CONTENT ---- */
#page-content {
    flex: 1;
    padding: 24px;
    overflow-x: hidden;
}

/* ---- PAGE TITLE ---- */
.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.page-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ============================================================
   CARD
   ============================================================ */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: background var(--transition), border-color var(--transition);
}

.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.card-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

.card-body {
    padding: 18px;
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group input,
.filter-group select {
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color 0.18s, background 0.18s;
    min-width: 120px;
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: var(--primary);
    background: var(--surface);
}

/* Checkbox custom */
.check-group {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 34px;
}

.check-group label {
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

.check-group input[type="checkbox"] {
    width: 15px; height: 15px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Autorefresh toggle */
.refresh-group {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    background: var(--primary-light);
    padding: 0 10px;
    border-radius: 7px;
    border: 1px solid rgba(67,97,238,0.2);
}

.refresh-group label {
    font-size: 12px;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.refresh-group input[type="checkbox"] {
    accent-color: var(--primary);
}

#refresh-countdown {
    font-size: 11px;
    color: var(--primary);
    font-weight: 700;
    min-width: 16px;
    text-align: center;
}

.refresh-countdown-text {
    font-size: 11px;
    color: var(--primary);
    font-weight: 700;
    min-width: 16px;
    text-align: center;
}

/* Tombol filter */
.btn {
    height: 34px;
    padding: 0 16px;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.18s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--surface-2);
    color: var(--text);
}

/* ============================================================
   TABEL
   ============================================================ */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    /*font-size: 13px;*/
font-size: 12px;
}

thead th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-align: left;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}

tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child { border-bottom: none; }

tbody td {
    padding: 9px 12px;
    color: var(--text);
    vertical-align: middle;
}

/* ---- Badge status ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    /*font-size: 11px;*/
font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: rgba(16,185,129,0.12); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.12); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,0.12);  color: var(--danger);  }
.badge-info    { background: rgba(59,130,246,0.12);  color: var(--info);    }
.badge-muted   { background: var(--surface-2);       color: var(--text-muted); }

/* ---- Info jumlah data ---- */
.table-info {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ---- Loading overlay ---- */
.loading-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(var(--surface), 0.8);
    z-index: 10;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    pointer-events: none
}

.loading-overlay.active {
    display: flex;
    pointer-events: none
}

.spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 9px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text);
    box-shadow: var(--shadow-md);
    min-width: 220px;
    max-width: 320px;
    animation: toastIn 0.28s ease;
}

.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    :root { --sidebar-w: 240px; }
    #page-content { padding: 16px; }
    .filter-bar { gap: 8px; }
}

/* ============================================================
   DATEPICKER OVERRIDE (Pikaday)
   ============================================================ */
.pika-single {
    font-family: inherit;
    border-radius: var(--radius);
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-md);
    font-size: 13px;
}

.pika-label, .pika-prev, .pika-next { color: var(--text); }
.pika-button { color: var(--text); }
.pika-button:hover { background: var(--primary-light); color: var(--primary); }
.is-selected .pika-button { background: var(--primary); color: #fff; }
.is-today .pika-button { color: var(--primary); font-weight: 700; }

thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface-2);
}
.table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 500px; /* sesuaikan tinggi yang diinginkan */
    border-radius: var(--radius);
}


.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}

.context-menu-item:hover {
    background: var(--surface-2);
}

.context-menu-item.danger:hover {
    background: rgba(239,68,68,0.1);
    color: var(--danger);
}

.context-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/*
.table-wrap td, .table-wrap th {
    white-space: nowrap;
    padding: 9px 10px;
}
*/
#tx-modal-body, #tx-modal-body * {
    user-select: text !important;
    -webkit-user-select: text !important;
}
.table-wrap th {
    position: relative;
}

.col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 5;
}

.col-resizer:hover,
.col-resizer.resizing {
    background: var(--primary);
    opacity: 0.5;
}
/*
.ib-table {
    table-layout: auto !important;
white-space: nowrap;
padding: 9px 10px;
}*/
/*
.ob-table {
    table-layout: fixed;
}*/

.depo-table {
    table-layout: auto;
    width: auto;
}
/*
.lh-table {
    table-layout: auto;
    width: auto;
}*/
/*
#login-overlay {
    transition: opacity 0.5s ease;
    opacity: 1;
}
#login-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}*/