:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
    --sidebar-width: 250px;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f8f9fc;
    color: var(--dark-color);
    overflow-x: hidden;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #4e73df 10%, #224abe 100%);
    color: white;
    z-index: 1000;
    transition: all 0.3s;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    display: flex;
    flex-direction: column;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    margin-top: auto;
}

.sidebar-footer .user-info {
    margin-bottom: 1rem;
}

.sidebar-footer .user-info img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-bottom: 0.5rem;
}

.sidebar-footer .user-info .username {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.sidebar-footer .user-info .role {
    font-size: 0.8rem;
    opacity: 0.8;
}

.sidebar-footer .logout-btn {
    display: block;
    width: 100%;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    text-align: center;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-footer .logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-header {
    padding: 1rem;
    margin-top: 5pt;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h3 {
    font-weight: 600;
    font-size: 1.2rem;
}

.sidebar-menu {
    padding: 1rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    /* padding: 0.8rem 1.5rem; */
    padding: 0.5rem;
    padding-left: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 400;
}

.sidebar-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.2);
    border-left: 4px solid white;
}

.sidebar-link i {
    font-size: 1rem;
    width: 1.5rem;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    background: linear-gradient(180deg, #4e73df 10%, #224abe 100%);
}

/* Card Styles */
.card {
    border: none;
    border-radius: 0.35rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    margin-bottom: 1.5rem;
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-3px);
}

.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* Table Styles */
.table {
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid #e3e6f0;
    font-weight: 600;
    color: var(--dark-color);
    position: relative;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

/* Table row selection */
.table tbody tr.selected>* {
    box-shadow: inset 0 0 0 9999px rgb(13 110 253 / 30%);
    background-color: rgba(78, 115, 223, 0.2) !important;
    border-left: 4px solid inset 0 0 0 9999px rgb(13 110 253 / 30%);
    transition: all 0.2s ease;
}

/* Visual feedback for long press */
.table tbody tr {
    position: relative;
    transition: background-color 0.2s;
}

.table tbody tr::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(78, 115, 223, 0.1);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.table tbody tr.long-press-active::after {
    opacity: 1;
}

/* Hidden columns */
.table th.hidden, .table td.hidden {
    display: none;
}

/* Badge Styles */
.badge {
    padding: 0.35em 0.65em;
    font-weight: 500;
    font-size: 0.75rem;
}

/* Footer */
.footer {
    background-color: white;
    border-top: 1px solid #e3e6f0;
    padding: 1rem;
    margin-top: auto;
}

/* Search Box */
.search-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-box {
    width: 100%;
    /* padding: 0.75rem 1rem 0.75rem 2.5rem; */
    padding: 0.4rem 1rem 0.4rem 2.5rem;
    border: 1px solid #d1d3e2;
    border-radius: 0.35rem;
    background-color: white;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.search-box:focus {
    border-color: #bac8f3;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
    outline: 0;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
}

/* Dashboard Cards */
.dashboard-card {
    border-left: 0.25rem solid;
    padding: 1rem;
    border-radius: 0.35rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.dashboard-card.primary {
    border-left-color: var(--primary-color);
}

.dashboard-card.success {
    border-left-color: var(--success-color);
}

.dashboard-card.danger {
    border-left-color: var(--danger-color);
}

.dashboard-card.info {
    border-left-color: var(--info-color);
}

.dashboard-card .card-value {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0.5rem 0;
}

.dashboard-card .card-text {
    color: var(--secondary-color);
    font-size: 0.85rem;
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    z-index: 99999;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    padding: 8px 0;
    min-width: 160px;
    display: none;
    font-family: 'Poppins', sans-serif;
    transform-origin: top left;
    /* For mobile */
    max-width: 80%;
    overflow: hidden;
}

.context-menu-item {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
    font-size: 15px;
}

.context-menu-item:hover {
    background-color: #f1f1f1;
}

.context-menu-item i {
    margin-right: 12px;
    width: 18px;
    text-align: center;
    font-size: 16px;
}

.context-menu-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 6px 0;
}

/* Column Visibility Toggle */
.column-visibility {
    position: relative;
    display: inline-block;
}

.column-visibility-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.column-visibility-btn:hover {
    color: #4e73df;
}

/* Column Visibility Dropdown */
.column-visibility-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 99999;
    background-color: white;
    border-radius: 0.35rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    padding: 0.5rem;
    min-width: 200px;
    display: none;
}

.column-visibility-dropdown.show {
    display: block;
}

.column-visibility-item {
    display: flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

.column-visibility-item:hover {
    background-color: #f8f9fc;
}

.column-visibility-checkbox {
    margin-right: 0.5rem;
}

.column-visibility-label {
    flex-grow: 1;
    font-size: 0.875rem;
}

/* Table header actions */
.table-header-actions {
    display: flex;
    align-items: center;
}

.table-header-actions .column-visibility {
    margin-right: 0.5rem;
}

/* Export Dropdown */
.export-dropdown {
    position: relative;
    display: inline-block;
}


/* Export Dropdown */
.export-dropdown .export-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 99999;
    display: none;
    min-width: 180px;
    background-color: white;
    border-radius: 0.35rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    padding: 0.5rem 0;
    margin-top: 0.25rem;
}

.export-dropdown .export-menu.show {
    display: block;
}

.export-dropdown .export-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: #5a5c69;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.export-dropdown .export-item:hover {
    background-color: #f8f9fc;
    color: #4e73df;
}

.export-dropdown .export-item i {
    margin-right: 0.75rem;
    width: 16px;
    text-align: center;
}

.export-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.export-btn:hover {
    color: #4e73df;
}

/* Sortable table header */
.table th.sortable {
    position: relative;
    cursor: pointer;
    user-select: none;
    padding-right: 25px !important;
}

.table th.sortable:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.table th.sortable::after {
    content: '\f0dc';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.3;
    font-size: 12px;
}

.table th.sortable.asc::after {
    content: '\f0de';
    opacity: 1;
    color: var(--primary-color);
}

.table th.sortable.desc::after {
    content: '\f0dd';
    opacity: 1;
    color: var(--primary-color);
}

/* Keep the resize handle working with sortable headers */
.table th.sortable .resize-handle {
    right: 0;
}

/* Table Header Resize */
.table th.resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
}

.table th.resize-handle:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center; /* Vertically center */
  justify-content: center; /* Horizontally center */
  z-index: 1000; /* Ensure it's on top of other content */
  display: none; /* Hidden by default */
}

.modal-container {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    animation: modalFadeIn 0.3s;
    position: relative; /* For positioning the close button */
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: #888;
}

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

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-control:focus {
    border-color: #4e73df;
    outline: none;
    box-shadow: 0 0 0 2px rgba(78, 115, 223, 0.25);
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #4e73df;
    color: white;
}

.btn-primary:hover {
    background-color: #2e59d9;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #e74a3b;
    color: white;
}

.btn-danger:hover {
    background-color: #d73527;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-success {
    background-color: #1cc88a;
    color: white;
}

.btn-success:hover {
    background-color: #17a673;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 20px !important;
    right: 20px !important;
    z-index: 99999 !important;
    pointer-events: none;
}

.toast {
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 15px 20px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    min-width: 250px;
    animation: slideInRight 0.3s;
    position: relative !important;
    z-index: 99999 !important;
    pointer-events: auto;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-success {
    border-left: 4px solid #1cc88a;
}

.toast-error {
    border-left: 4px solid #e74a3b;
}

.toast-icon {
    margin-right: 10px;
    font-size: 18px;
}

.toast-success .toast-icon {
    color: #1cc88a;
}

.toast-error .toast-icon {
    color: #e74a3b;
}

.toast-message {
    flex-grow: 1;
}

/* Perbaikan untuk memastikan toast muncul di atas elemen lain */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    pointer-events: none;
}

.toast {
    position: relative;
    z-index: 1;
    pointer-events: auto;
    margin-bottom: 10px;
}

/* Gaya untuk menyingkat teks */
.singkat-teks {
    max-width: 300px; /* Atur lebar maksimum yang diinginkan */
    white-space: wrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /*display: block;  Penting untuk agar properti di atas berfungsi */
}

.line {
  border-bottom: 2px solid ;
  width: 100%;
}

.line-menu {
  border-bottom: 1px solid ;
  margin-top: 15px;
  width: 80%;
}


/* Responsive Styles */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
        padding-top: 56px;
    }
    
    .mobile-nav {
        display: block;
    }
    
    .dashboard-card {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        font-size: 0.85rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .context-menu {
        border-radius: 12px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
        min-width: 200px;
        /* Ensure it's above other elements */
        transform: translateZ(0);
    }
    
    .context-menu-item {
        padding: 15px 20px;
        font-size: 16px;
        /* Larger touch target */
        min-height: 50px;
    }
    
    .context-menu-item i {
        font-size: 18px;
        margin-right: 15px;
    }
    
    /* Add visual feedback for touch */
    .context-menu-item:active {
        background-color: #e9ecef;
    }
    
    /* Make table rows easier to touch */
    .table tbody tr {
        min-height: 50px;
    }
    
    /* Add ripple effect for touch feedback */
    .table tbody tr {
        position: relative;
        overflow: hidden;
    }

    .table tbody tr ::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.5);
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s;
    }

    .table tbody tr.long-press-active::before {
        width: 300px;
        height: 300px;
    }
}   

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

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}



/* Table footer */
.me-3 {
    background-color: #f8f9fc;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.me-3 span {
    font-size: 0.875rem;
    color: #5a5c69;
}

.me-3 strong {
    color: #4e73df;
}

@media (max-width: 768px) {
    .me-3 {
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 10pt;
    }

    .d-flex {
        display: flex !important;
        flex-wrap: wrap;
    }
}



.btn-aksi { 
    border: none; 
    padding: 8px 10px; 
    border-radius: 4px; 
    cursor: pointer; 
    color: white; 
    margin-right: 5px; 
}

.btn i {
    pointer-events: none;
}

.result-footer {
    padding: 5px;
    font-weight: bold;
    background-color: bisque;
    display: flex;
    justify-content: space-between;
}



/* untuk downline  */
/* --- Gaya Global & Layout Utama --- */
/* body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f4f6f9;
    color: #333;
} */


.section { flex: 1; background: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); padding: 0px; }

/* Network List Styles */
.network-list { list-style: none; padding: 0; }
.network-item { 
    margin: 12px 0; 
    padding: 12px 16px; 
    border-radius: 6px; 
    transition: all 0.2s ease;
    cursor: pointer;
}
.network-item:hover { background-color: #f1f3f5; }
.network-item.active { background-color: #e7f3ff; }

.item-header { display: flex; justify-content: space-between; align-items: center; }
.item-name { font-weight: 500; }
.dropdown-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.dropdown-btn.expanded { transform: rotate(180deg); }

.sub-items {
    margin-top: 8px;
    padding-left: 24px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}
.sub-items.expanded { max-height: 1000px; }

/* Tree Structure Styles */
.tree-container { padding: 0; }
.tree-node {
    display: flex;
    align-items: center;
    margin: 8px 0;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}
.tree-node:hover { background-color: #f8f9fa; }

.toggle-icon {
    margin-right: 8px;
    color: #6c757d;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.toggle-icon.expanded { transform: rotate(90deg); }

.node-content { flex-grow: 1; }

.children-container {
    margin-left: 24px;
    border-left: 2px solid #dee2e6;
    padding-left: 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}
.children-container.expanded { max-height: 100%; }

.level-1 { color: #495057; }
.level-2 { color: #6c757d; }
.level-3 { color: #868e96; }

.level-1 { background-color: #d4edda; color: #155724; }
.level-2 { background-color: #d1ecf1; color: #0c5460; }
.level-3 { background-color: #fff3cd; color: #856404; }
.inactive { background-color: #f8d7da; color: #721c24; }
.top-level { background-color: #e2e3e5; color: #383d41; }

@media (max-width: 768px) {
    .container { flex-direction: column; }
}