/* ==========================================================================
   STYLESAFFILIATOR.CSS — Halaman Affiliator (satuan rem, 1rem = 16px @400px)
   ========================================================================== */

#affiliator-dashboard {
    --af-hijau: #0A7B3E;
    --af-hijau-terang: #E6F7EC;
    --af-hijau-hover: #086632;
    --af-latar: #f8f9fa;
    --af-kartu: #FFFFFF;
    --af-abu: #6B7280;
    --af-teks: #1F2937;
    --af-teks2: #4B5563;
    --af-border: #F0F0F0;
    --af-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.04), 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.03);
    --af-r-kartu: 1rem;
    --af-r-tombol: 0.75rem;
    --af-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    position: static;
    width: 100%;
    max-width: 75rem;
    margin: 0 auto;
    height: auto;
    min-height: calc(100vh - 5.4rem - env(safe-area-inset-bottom));
    min-height: calc(100dvh - 5.4rem - env(safe-area-inset-bottom));
    padding: 0 0 0.5rem;
    background-image: url("https://img.sukahemat.com/ilustrasi/bg-affiliator.avif");
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    color: var(--af-teks);
    font-family: var(--af-font);
    line-height: 1.5;
    flex-direction: column;
    overflow: visible;
    -webkit-font-smoothing: antialiased;
}

#affiliator-dashboard:not(.active) {
    display: none !important;
}

#affiliator-dashboard.active {
    display: flex !important;
}

:where(#affiliator-dashboard) * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

#affiliator-dashboard .af-hijau-text {
    color: var(--af-hijau);
}

/* ---------- HEADER ---------- */
.af-header {
    background: var(--af-kartu);
    border-bottom: 0.0625rem solid var(--af-border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.af-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0 1rem;
}

.af-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}

.af-brand-text {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--af-teks);
    letter-spacing: -0.02rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 12rem;
}

.af-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.af-greeting {
    font-size: 0.875rem;
    color: var(--af-teks2);
    white-space: nowrap;
    display: none;
}

@media (min-width: 31.25em) {
    .af-greeting {
        display: inline;
    }
}

.af-icon-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background: var(--af-latar);
    color: var(--af-teks2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.af-icon-btn:hover {
    background: #E5E7EB;
}

.af-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #A7F3D0, #6EE7B7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9375rem;
    letter-spacing: 0.02rem;
    color: #065F46;
    flex-shrink: 0;
    border: 0.125rem solid #fff;
    box-shadow: var(--af-shadow);
}

/* ---------- LAYOUT ---------- */
.af-main {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0 0.75rem 1rem;
}

@media (min-width: 48em) {
    .af-main {
        grid-template-columns: 1fr 1fr;
    }

    .af-full {
        grid-column: 1 / -1;
    }
}

/* ---------- KARTU ---------- */
.af-card {
    background: #fff;
    border: 0.0625rem solid #e9ecef;
    border-radius: 0.75rem;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.08);
    padding: 0.75rem;
    overflow: hidden;
}

.af-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.af-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.af-card-title i {
    width: 1.125rem;
    font-size: 1.2rem;
    text-align: center;
    color: var(--af-hijau);
}

.af-p {
    font-size: 0.8125rem;
    color: var(--af-teks2);
    margin-bottom: 0.75rem;
}

.af-jumlah {
    font-size: 0.75rem;
    color: var(--af-abu);
}

/* ---------- RINGKASAN KOMISI ---------- */
.af-komisi-utama {
    background-image: url("https://img.sukahemat.com/ilustrasi/bg-komisi.avif");
    /*linear-gradient(135deg, #0A7B3E 0%, #0D9B4E 100%)*/
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    border-radius: 0.75rem;
    padding: 1.25rem 0.75rem;
    color: #fff;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.af-komisi-utama::after {
    content: '';
    position: absolute;
    top: -1.875rem;
    right: -1.25rem;
    width: 8.75rem;
    height: 8.75rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.af-komisi-label {
    font-size: 0.8125rem;
    opacity: 0.9;
    font-weight: 500;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    position: relative;
    z-index: 1;
}

.af-komisi-angka {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.0625rem;
    line-height: 1.2;
    margin-bottom: 0.375rem;
    position: relative;
    z-index: 1;
}

.af-komisi-sub {
    font-size: 0.8125rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    position: relative;
    z-index: 1;
}

.af-periode-selector {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.75rem;
    position: relative;
    z-index: 1;
}

.af-periode-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 0.0625rem solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 0.375rem 0.875rem;
    border-radius: 1.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: var(--af-font);
}

.af-periode-btn.aktif {
    background: #fff;
    color: var(--af-hijau);
    font-weight: 600;
    border-color: #fff;
}

.af-periode-btn:hover:not(.aktif) {
    background: rgba(255, 255, 255, 0.25);
}

.af-komisi-foot {
    margin-top: 0.875rem;
    display: flex;
    gap: 1.25rem;
    font-size: 0.8125rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.af-komisi-foot span {
    opacity: 0.75;
}

/* ---------- STATUS AKUN ---------- */
.af-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.af-status-badge i {
    font-size: 0.8rem;
}

.af-status-aktif {
    background: var(--af-hijau-terang);
    color: var(--af-hijau);
}

.af-status-nonaktif {
    background: #FEF3C7;
    color: #92400E;
}

.af-status-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.af-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.af-status-label {
    color: var(--af-teks2);
}

.af-status-value {
    font-weight: 600;
    color: var(--af-teks);
}

.af-cta-perpanjang {
    display: inline-block;
    background: var(--af-hijau);
    color: #fff;
    padding: 0.625rem 1.25rem;
    border-radius: var(--af-r-tombol);
    font-weight: 600;
    font-size: 0.9rem;
    font-family: var(--af-font);
    text-align: center;
    border: none;
    cursor: pointer;
    margin-top: 0.375rem;
    transition: background 0.2s;
}

.af-cta-perpanjang:hover {
    background: var(--af-hijau-hover);
}

/* ---------- INFO PENCAIRAN ---------- */
.af-info-pencairan {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.af-info-row {
    display: flex;
    gap: 0.625rem;
    align-items: flex-start;
    font-size: 0.8rem;
    color: var(--af-teks2);
    line-height: 1.5;
}

.af-info-row i {
    width: 1.125rem;
    font-size: 1rem;
    text-align: center;
    color: var(--af-hijau);
    flex-shrink: 0;
    margin-top: 0.15rem;
}

/* ---------- STATISTIK ---------- */
.af-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.af-stat-item {
    background: var(--af-latar);
    border-radius: 0.75rem;
    padding: 0.875rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.af-stat-label {
    font-size: 0.9rem;
    color: var(--af-teks2);
    font-weight: 500;
}

.af-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--af-teks);
    letter-spacing: -0.02rem;
}

.af-stat-sub {
    font-size: 0.8rem;
    color: var(--af-abu);
}

/* ---------- AJAK TEMAN ---------- */
.af-referral-box {
    background: var(--af-hijau-terang);
    border-radius: 0.75rem;
    padding: 0.875rem;
    margin-top: 0.5rem;
}

.af-referral-code {
    font-family: 'Courier New', monospace;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--af-hijau);
    letter-spacing: 0.0625rem;
    background: #fff;
    padding: 0.625rem 0.875rem;
    border-radius: 0.625rem;
    text-align: center;
    border: 0.0625rem dashed #A7F3D0;
    margin-bottom: 0.75rem;
    word-break: break-all;
}

.af-referral-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.af-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: var(--af-r-tombol);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: var(--af-font);
    flex: 1;
    min-width: 7.5rem;
}

.af-btn i {
    font-size: 1rem;
}

.af-btn-outline {
    background: #fff;
    color: var(--af-hijau);
    border: 0.09375rem solid var(--af-hijau);
}

.af-btn-outline:hover {
    background: var(--af-hijau-terang);
}

.af-btn-wa {
    background: #25D366;
    color: #fff;
}

.af-btn-wa:hover {
    background: #1DAF54;
}

.af-btn-retry {
    flex: none;
    margin-top: 0.5rem;
}

/* ---------- RIWAYAT ---------- */
.af-filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
    flex-wrap: wrap;
}

.af-search-input {
    flex: 1;
    min-width: 10rem;
    padding: 0.625rem 0.875rem;
    border: 0.0625rem solid #E5E7EB;
    border-radius: var(--af-r-tombol);
    font-size: 0.875rem;
    font-family: var(--af-font);
    background: var(--af-latar);
    outline: none;
    transition: border 0.2s;
}

.af-search-input:focus {
    border-color: var(--af-hijau);
    background: #fff;
}

.af-filter-select {
    padding: 0.625rem 0.875rem;
    border: 0.0625rem solid #E5E7EB;
    border-radius: var(--af-r-tombol);
    font-size: 0.875rem;
    font-family: var(--af-font);
    background: var(--af-latar);
    cursor: pointer;
    outline: none;
}

.af-filter-select:focus {
    border-color: var(--af-hijau);
}

.af-riwayat-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.af-riwayat-item {
    background: var(--af-latar);
    border-radius: 0.75rem;
    padding: 0.875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.2s;
}

.af-riwayat-item:hover {
    background: #F3F4F6;
}

.af-riwayat-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.af-riwayat-order {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--af-teks);
}

.af-riwayat-meta {
    font-size: 0.75rem;
    color: var(--af-abu);
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
    align-items: center;
}

.af-riwayat-nominal {
    text-align: right;
    flex-shrink: 0;
}

.af-nominal {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--af-hijau);
    white-space: nowrap;
}

.af-badge-komisi {
    display: inline-block;
    padding: 0.125rem 0.625rem;
    border-radius: 0.75rem;
    font-size: 0.6875rem;
    font-weight: 600;
    margin-top: 0.25rem;
    white-space: nowrap;
}

.af-badge-kecil {
    font-size: 0.625rem;
    margin-top: 0;
}

.af-badge-diperoleh {
    background: #D1FAE5;
    color: #065F46;
}

.af-badge-menunggu {
    background: #FEF3C7;
    color: #92400E;
}

.af-badge-tidak {
    background: #FEE2E2;
    color: #B91C1C;
}

.af-badge-selesai {
    background: #DBEAFE;
    color: #1E40AF;
}

/* ---------- ACCORDION (Ketentuan & FAQ) ---------- */
.af-acc-item {
    border-bottom: 0.0625rem solid var(--af-border);
}

.af-acc-item:last-child {
    border-bottom: none;
}

.af-acc-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--af-teks);
    cursor: pointer;
    text-align: left;
    font-family: var(--af-font);
    gap: 0.75rem;
}

.af-acc-header i {
    font-size: 0.85rem;
    color: var(--af-abu);
    transition: transform 0.25s;
    flex-shrink: 0;
}

.af-acc-item.terbuka .af-acc-header i {
    transform: rotate(180deg);
}

.af-acc-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    font-size: 0.8125rem;
    color: var(--af-teks2);
    line-height: 1.6;
}

.af-acc-item.terbuka .af-acc-body {
    max-height: 31.25rem;
    padding-bottom: 1rem;
}

.af-ketentuan {
    padding-left: 1.125rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

/* ---------- PANDUAN LANGKAH ---------- */
.af-langkah-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 31.25em) {
    .af-langkah-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.af-langkah-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--af-latar);
    border-radius: 0.75rem;
    align-items: flex-start;
}

.af-langkah-nomor {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--af-hijau);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.af-langkah-konten {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.af-langkah-judul {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--af-teks);
}

.af-langkah-desc {
    font-size: 0.75rem;
    color: var(--af-abu);
    line-height: 1.4;
}

/* ---------- EMPTY STATE & TOAST ---------- */
.af-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--af-abu);
}

.af-empty i {
    font-size: 2.5rem;
    color: #D1D5DB;
    margin-bottom: 0.625rem;
    display: block;
}

.af-empty p {
    font-size: 0.875rem;
}

.af-toast {
    position: fixed;
    bottom: 7rem;
    left: 50%;
    transform: translateX(-50%) translateY(1.25rem);
    background: var(--af-teks);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 1.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    z-index: 2300;
    white-space: nowrap;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.2);
}

.af-toast.tampil {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}