/* ================== TAB affiliator - ELEGANT DESIGN ================== */
#affiliator-dashboard {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    background-color: #ffffff;
    overflow-y: auto;
    padding: 0.75rem 0.5rem 0.75rem 0.5rem;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1060;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    display: none;
}

#affiliator-dashboard.active {
    transform: translateX(0);
    display: block;
}

/* ================== TABS STICKY ================== */
#affiliator-tabs {
    position: sticky;
    top: -0.75rem;
    left: -0.75rem;
    right: 0;
    background: linear-gradient(135deg, #dbcbff, #e7f3ff);
    border-top: 3px solid #86c0fa;
    border-bottom: 3px solid #86c0fa;
    padding: 0.25rem 0.75rem;
    margin: 0 -0.75rem 1rem;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    
    /* Tambahkan ini */
    display: flex;
    gap: 0.5rem;
}

#affiliator-tabs::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, #dee2e6, transparent);
}

/* Agar konten di bawah tab tidak tertutup */
#affiliator-tab-content {
    padding-top: 8px;
}

/* Tab Button */
.affiliator-tab-btn {
    position: relative;
    padding: 0.25rem 0.25rem;
    margin: 0.25rem 0;
    font-weight: 600;
    color: #6c757d;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 1rem;

    /* Tambahkan ini */
    flex: 1; 
    width: 100%;
}

.affiliator-tab-btn i {
    font-size: 0.95rem;
}

.affiliator-tab-btn:hover:not(.active) {
    color: #e67e22;
    background: rgba(230, 126, 34, 0.08);
}

.affiliator-tab-btn.active {
    color: #e67e22;
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.15);
}

/* Tab Content */
.affiliator-tab-pane {
    padding: 0;
    min-height: 320px;
    background: #ffffff;
}

/* Tambahkan di bagian akhir stylesAffiliator.css */
.affiliator-summary-box {
    background: white;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 3px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.summary-stats {
    display: flex;
    gap: 0.4rem;
    text-align: center;
}

.summary-item:first-child {
    flex: 1; /* Total Member */
}

.summary-item.total-komisi {
    flex: 3; /* Total Komisi */
}

.summary-item h6 {
    margin: 0;
    font-size: 0.7rem;
    color: #666;
    font-weight: 500;
}

.summary-item .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-top: 4px;
}

.summary-item.total-komisi .value {
    color: #27ae60;
}

/* ================== TOP affiliator - DESAIN PREMIUM ================== */
.top-list {
    background: #fafdff;
    border-radius: 0.25rem;
    border: 1px solid #eef3f9;
    overflow: hidden;
    margin: 1rem 0;
}

.top-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 10px solid #edf2f8;
    gap: 0.5rem;
    transition: 0.2s;
}

.top-item:last-child {
    border-bottom: 0;
}

.top-item.self {
    background: #f0f6ff;
    border-left: 5px solid #2563eb;
}

.rank-nomor {
    font-weight: 700;
    font-size: 1.2rem;
    color: #475569;
}

.top-item.self .rank-nomor {
    color: #2563eb;
}

.top-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* WAJIB: Agar flex child bisa menyusut di bawah ukuran konten aslinya */
    flex: 1;
    /* Mengambil sisa ruang yang ada di antara Rank dan Omzet */
}

.top-name {
    font-weight: 600;
    color: #0f172a;
    font-size: 0.9rem;
    display: block;
    /* Diubah ke block agar overflow bekerja dengan sempurna pada teks tunggal */

    /* Kombinasi maut untuk membuat "..." */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-meta {
    font-size: 0.65rem;
    color: #64748b;
    display: flex;
    gap: 0.5rem;
    margin-top: 6px;
    white-space: nowrap;
}

.top-meta i {
    width: 0.65rem;
}

.top-poin {
    font-weight: 600;
    background: #8fffc7;
    padding: 0.5rem;
    border-radius: 15px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.top-item.self .top-poin {
    background: #8fffc7;
    color: #1e40af;
}

.top-item.self .top-name {
    color: #1e40af;
}

.top-item.self {
    background: linear-gradient(90deg, #f0f6ff, #dbeafe) !important;
    border: 1px solid #2563eb !important;
    border-radius: 15px;
    border-left: 6px solid #2563eb !important;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25) !important;
    position: relative;
}

/* TAB LEVEL HORIZONTAL */
.level-tabs-horizontal {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding: 8px 4px;
    scrollbar-width: thin;
}

.level-tab-btn {
    flex: 1;
    padding: 0.25rem 0.1rem;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 0.5rem;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.level-tab-btn.active {
    border-color: #f39c12;
    background: linear-gradient(135deg, #fffaf0, #ffe4b3);
    box-shadow: 0 6px 16px rgba(243, 156, 18, 0.35);
    transform: translateY(-3px);
}

.level-label {
    font-size: 0.7rem;
    color: #666;
    font-weight: 500;
    margin-bottom: 2px;
}

.level-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: #f39c12;
    margin-bottom: 6px;
}

/* KOMISI HEADER MODERN */
.komisi-header-modern {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e9ecef;
    border-radius: 16px;
    padding: 20px;
    margin: 1rem 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.komisi-header-content {
    display: flex;
    flex-direction: row; /* Bersebelahan secara horizontal */
    gap: 0.4rem;
}

/* Base Style untuk kedua Box (Padding & Radius) */
.member-box, .komisi-box {
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    text-align: center;
}

/* Mengatur Proporsi Lebar */
.member-box {
    flex: 1;
    background: rgba(47, 128, 237, 0.08);
    border: 1px solid rgba(47, 128, 237, 0.2);
}

.komisi-box {
    flex: 4;
    background: rgba(39, 174, 96, 0.08);
    border: 1px solid rgba(39, 174, 96, 0.2);
}

/* Desain Teks Member Box */
.member-label {
    font-size: 0.7rem;
    color: #2f80ed;
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.member-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2f80ed;
    line-height: 1;
}

/* Desain Teks Komisi Box */
.komisi-label {
    font-size: 0.7rem;
    color: #27ae60;
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.komisi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #27ae60;
    line-height: 1;
}

/* Downline Item */
.downline-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.downline-item {
    background: white;
    border-radius: 12px;
    padding: 14px 16px;
    border: 1px solid #eee;
    transition: all 0.2s;
}

.downline-item:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transform: translateX(4px);
}