/* ================================================================
   MLM Pro — Custom Dark Theme (Bootstrap 5.3 override)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ── Root Variables ──────────────────────────────────────────── */
:root {
    --app-bg:         #080816;
    --app-bg2:        #0f0f24;
    --card-bg:        rgba(255, 255, 255, 0.04);
    --card-border:    rgba(255, 255, 255, 0.09);
    --card-hover:     rgba(255, 255, 255, 0.07);
    --violet:         #7c3aed;
    --cyan:           #06b6d4;
    --gold:           #f59e0b;
    --green:          #10b981;
    --red:            #ef4444;
    --text-primary:   #f1f5f9;
    --text-muted:     #94a3b8;
    --grad-primary:   linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
    --grad-gold:      linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --grad-green:     linear-gradient(135deg, #10b981 0%, #059669 100%);
    --grad-violet:    linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    --radius:         14px;
    --radius-sm:      10px;
    --shadow:         0 8px 32px rgba(0, 0, 0, 0.45);
    --nav-h:          68px;
}

/* ── Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: 'Outfit', sans-serif;
    background: var(--app-bg);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--violet); }

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--app-bg); }
::-webkit-scrollbar-thumb { background: var(--violet); border-radius: 3px; }

/* ── Gradient Utilities ───────────────────────────────────────── */
.gradient-text {
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.gradient-text-gold {
    background: var(--grad-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Glass Card ───────────────────────────────────────────────── */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: border-color .25s, transform .2s;
}
.glass-card:hover { border-color: rgba(124,58,237,.35); }

/* ── Stat Cards ───────────────────────────────────────────────── */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    opacity: .12;
}
.stat-card.violet::before { background: var(--violet); }
.stat-card.cyan::before   { background: var(--cyan); }
.stat-card.gold::before   { background: var(--gold); }
.stat-card.green::before  { background: var(--green); }

.stat-card .stat-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; margin: .2rem 0; }
.stat-card .stat-icon  { font-size: 1.4rem; opacity: .7; }

/* ── Gradient Buttons ─────────────────────────────────────────── */
.btn-grad {
    background: var(--grad-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    letter-spacing: .03em;
    transition: opacity .2s, transform .15s, box-shadow .2s;
    box-shadow: 0 4px 15px rgba(124, 58, 237, .35);
}
.btn-grad:hover  { opacity: .88; transform: translateY(-1px); color:#fff; box-shadow: 0 6px 20px rgba(124,58,237,.5); }
.btn-grad:active { transform: scale(.97); }

.btn-grad-gold {
    background: var(--grad-gold);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(245, 158, 11, .3);
    transition: opacity .2s, transform .15s;
}
.btn-grad-gold:hover { opacity: .88; transform: translateY(-1px); color:#fff; }

.btn-glass {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: background .2s, border-color .2s;
}
.btn-glass:hover { background: var(--card-hover); border-color: rgba(124,58,237,.4); color: var(--text-primary); }

/* ── Forms ────────────────────────────────────────────────────── */
.form-control, .form-select {
    background: rgba(255,255,255,.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
    background: rgba(255,255,255,.07);
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(124,58,237,.2);
    color: var(--text-primary);
}
.form-control::placeholder { color: var(--text-muted); }
.form-label { color: var(--text-muted); font-size: .85rem; font-weight: 500; }

/* ── Tables ───────────────────────────────────────────────────── */
.table {
    color: var(--text-primary);
    border-color: var(--card-border);
    font-size: .88rem;
}
.table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: rgba(255,255,255,.03);
    border-color: var(--card-border);
}
.table td { border-color: var(--card-border); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: rgba(255,255,255,.03); }
.table-responsive { border-radius: var(--radius); }

/* ── Badges ───────────────────────────────────────────────────── */
.badge { font-weight: 500; font-size: .7rem; letter-spacing: .04em; padding: .35em .65em; }

/* ── Alerts ───────────────────────────────────────────────────── */
.alert { border-radius: var(--radius-sm); border: 1px solid; font-size: .9rem; }
.alert-success { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.3); color: #6ee7b7; }
.alert-danger  { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.3);  color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: #fcd34d; }
.alert-info    { background: rgba(6,182,212,.1);  border-color: rgba(6,182,212,.3);  color: #67e8f9; }

/* ── Progress Bars ────────────────────────────────────────────── */
.progress {
    background: rgba(255,255,255,.08);
    border-radius: 99px;
    height: 8px;
}
.progress-bar.grad { background: var(--grad-primary); }

/* ── Pagination ───────────────────────────────────────────────── */
.page-link { background: var(--card-bg); border-color: var(--card-border); color: var(--text-muted); }
.page-link:hover { background: var(--card-hover); color: var(--text-primary); }
.page-item.active .page-link { background: var(--violet); border-color: var(--violet); color:#fff; }

/* ════════════════════════════════════════════════════════════════
   USER PANEL — Mobile App Layout
   ════════════════════════════════════════════════════════════════ */

.user-app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--app-bg);
    position: relative;
    padding-bottom: calc(var(--nav-h) + 1rem);
    /* Subtle side shadow to simulate phone frame */
    box-shadow: 0 0 60px rgba(124,58,237,.08);
}

/* ── Top Header ───────────────────────────────────────────────── */
.user-header {
    background: var(--app-bg);
    padding: .9rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
}
.user-header .brand { font-size: 1.15rem; font-weight: 700; }
.user-header .hdr-right { display: flex; align-items: center; gap: .6rem; }
.user-header .avatar {
    width: 34px; height: 34px;
    background: var(--grad-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem; color: #fff;
}

/* ── Hero Balance Banner ──────────────────────────────────────── */
.balance-banner {
    background: var(--grad-primary);
    margin: 1rem 1.25rem;
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
    position: relative;
    overflow: hidden;
}
.balance-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -15%;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,.08);
    border-radius: 50%;
}
.balance-banner .bal-label { font-size: .8rem; opacity: .8; letter-spacing: .05em; text-transform: uppercase; }
.balance-banner .bal-amount { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.balance-banner .bal-actions { display: flex; gap: .6rem; margin-top: .9rem; }
.balance-banner .bal-btn {
    flex: 1;
    background: rgba(255,255,255,.2);
    border: 1px solid rgba(255,255,255,.3);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: .45rem .6rem;
    font-size: .82rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background .2s;
    text-decoration: none;
    display: flex; align-items: center; justify-content: center; gap: .3rem;
}
.balance-banner .bal-btn:hover { background: rgba(255,255,255,.3); color:#fff; }

/* ── Page Sections ────────────────────────────────────────────── */
.page-section { padding: 0 1.25rem 1rem; }
.section-title {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: .6rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--card-border);
}

/* ── Mini Stat Chips ──────────────────────────────────────────── */
.chip-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.chip-row.three { grid-template-columns: 1fr 1fr 1fr; }

.stat-chip {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: .85rem .9rem;
    position: relative;
    overflow: hidden;
    transition: border-color .2s;
}
.stat-chip:hover { border-color: rgba(124,58,237,.4); }
.stat-chip .chip-icon { font-size: 1.3rem; margin-bottom: .35rem; display: block; }
.stat-chip .chip-val  { font-size: 1.05rem; font-weight: 700; }
.stat-chip .chip-lbl  { font-size: .7rem; color: var(--text-muted); font-weight: 500; }

/* ── Transaction List ─────────────────────────────────────────── */
.txn-list { display: flex; flex-direction: column; gap: .5rem; }
.txn-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    gap: .8rem;
    transition: border-color .2s;
}
.txn-item:hover { border-color: rgba(124,58,237,.3); }
.txn-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.txn-icon.deposit  { background: rgba(16,185,129,.15); color: var(--green); }
.txn-icon.withdraw { background: rgba(239,68,68,.15);  color: var(--red); }
.txn-icon.income   { background: rgba(124,58,237,.15); color: var(--violet); }
.txn-body { flex: 1; min-width: 0; }
.txn-body .txn-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-body .txn-meta { font-size: .72rem; color: var(--text-muted); }
.txn-amount { font-size: .95rem; font-weight: 700; white-space: nowrap; }
.txn-amount.plus  { color: var(--green); }
.txn-amount.minus { color: var(--red); }

/* ── Bottom Navigation ────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--nav-h);
    background: rgba(8, 8, 22, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--card-border);
    display: flex;
    align-items: stretch;
    z-index: 999;
}
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .2rem;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-muted);
    font-size: .68rem;
    font-weight: 500;
    transition: color .2s;
    padding: .4rem 0;
    border: none;
    background: transparent;
    position: relative;
}
.nav-item i { font-size: 1.3rem; transition: transform .2s; }
.nav-item.active { color: var(--violet); }
.nav-item.active i { transform: scale(1.1); }
.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: var(--grad-primary);
    border-radius: 0 0 3px 3px;
}
.nav-item:hover { color: var(--text-primary); }

/* ── Income Breakdown ─────────────────────────────────────────── */
.income-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: border-color .2s;
}
.income-card:hover { border-color: rgba(124,58,237,.4); }
.income-card .inc-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.income-card .inc-body { flex: 1; }
.income-card .inc-body .inc-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; }
.income-card .inc-body .inc-val   { font-size: 1.1rem; font-weight: 700; }
.income-card .inc-badge           { font-size: .72rem; }

/* ── Team Tree ────────────────────────────────────────────────── */
.ref-box {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    font-family: monospace;
    font-size: .9rem;
    word-break: break-all;
}
.ref-copy-btn {
    background: var(--grad-primary);
    border: none;
    border-radius: 8px;
    color: #fff;
    padding: .35rem .7rem;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity .2s;
}
.ref-copy-btn:hover { opacity: .82; }

.team-member {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: .65rem 1rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    margin-bottom: .4rem;
    transition: border-color .2s;
}
.team-member:hover { border-color: rgba(124,58,237,.3); }
.team-member .tm-avatar {
    width: 32px; height: 32px;
    background: var(--grad-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem; color:#fff;
    flex-shrink: 0;
}
.team-member .tm-body { flex:1; min-width:0; }
.team-member .tm-name { font-size: .85rem; font-weight: 600; }
.team-member .tm-meta { font-size: .72rem; color: var(--text-muted); }

/* ── Level Progress Cards ─────────────────────────────────────── */
.level-progress-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    margin-bottom: .75rem;
}
.level-badge {
    display: inline-flex; align-items: center; gap: .3rem;
    background: var(--grad-primary);
    color: #fff;
    border-radius: 99px;
    padding: .2rem .65rem;
    font-size: .72rem;
    font-weight: 700;
}

/* ════════════════════════════════════════════════════════════════
   ADMIN PANEL — Full-Width Layout with Sidebar
   ════════════════════════════════════════════════════════════════ */

.admin-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────── */
.admin-sidebar {
    width: 240px;
    background: rgba(255,255,255,.025);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 200;
    transition: transform .3s;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 1.4rem 1.2rem 1rem;
    border-bottom: 1px solid var(--card-border);
}
.sidebar-brand .brand-name { font-size: 1.15rem; font-weight: 800; }
.sidebar-brand .brand-sub  { font-size: .7rem; color: var(--text-muted); }

.sidebar-menu { padding: .8rem .6rem; flex: 1; }
.sidebar-menu .menu-label {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-muted);
    padding: .8rem .7rem .3rem;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .8rem;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: .88rem;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: .15rem;
    transition: background .2s, color .2s;
    position: relative;
}
.sidebar-link i { font-size: 1.05rem; width: 18px; text-align: center; }
.sidebar-link:hover { background: var(--card-hover); color: var(--text-primary); }
.sidebar-link.active {
    background: rgba(124,58,237,.15);
    color: var(--violet);
    border: 1px solid rgba(124,58,237,.2);
}
.sidebar-link .badge-count {
    margin-left: auto;
    background: var(--red);
    color: #fff;
    border-radius: 99px;
    font-size: .65rem;
    padding: .15rem .45rem;
    font-weight: 700;
}

.sidebar-footer {
    padding: .8rem .6rem 1rem;
    border-top: 1px solid var(--card-border);
}

/* ── Admin Main Content ───────────────────────────────────────── */
.admin-main {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-topbar {
    background: rgba(255,255,255,.02);
    border-bottom: 1px solid var(--card-border);
    padding: .9rem 1.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.admin-topbar .page-title { font-size: 1.1rem; font-weight: 700; }
.admin-topbar .topbar-right { display: flex; align-items: center; gap: .8rem; }

.admin-content { padding: 1.5rem 1.8rem; flex: 1; }

/* ── Admin Stat Cards ─────────────────────────────────────────── */
.admin-stat {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.2rem 1.4rem;
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.admin-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.admin-stat .ast-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    margin-bottom: .8rem;
}
.admin-stat .ast-val  { font-size: 1.6rem; font-weight: 800; }
.admin-stat .ast-lbl  { font-size: .78rem; color: var(--text-muted); font-weight: 500; }
.admin-stat .ast-sub  { font-size: .72rem; margin-top: .2rem; }

/* ── Mobile admin sidebar toggle ─────────────────────────────── */
@media (max-width: 991px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.show { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .sidebar-overlay {
        display: none;
        position: fixed; inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 199;
    }
    .sidebar-overlay.show { display: block; }
}

/* ── Landing / Auth Page ──────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--app-bg);
    background-image:
        radial-gradient(ellipse 600px 500px at 20% 50%, rgba(124,58,237,.12) 0%, transparent 70%),
        radial-gradient(ellipse 500px 400px at 80% 30%, rgba(6,182,212,.08) 0%, transparent 70%);
    padding: 1.5rem;
}
.auth-box {
    width: 100%;
    max-width: 440px;
}
.auth-logo { text-align: center; margin-bottom: 1.8rem; }
.auth-logo .logo-icon {
    width: 64px; height: 64px;
    background: var(--grad-primary);
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto .7rem;
    box-shadow: 0 8px 24px rgba(124,58,237,.4);
}
.auth-logo h1 { font-size: 1.6rem; font-weight: 800; margin: 0; }
.auth-logo p  { color: var(--text-muted); font-size: .88rem; margin: .2rem 0 0; }

.auth-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    background: transparent;
    padding: .6rem 1.4rem;
    font-weight: 600;
    border-radius: 10px 10px 0 0;
    transition: color .2s;
}
.auth-tabs .nav-link.active { color: var(--text-primary); background: var(--card-bg); }

/* ── Misc ─────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: .8rem; display: block; opacity: .4; }
.empty-state p { font-size: .9rem; }

.toast-notify {
    position: fixed;
    bottom: calc(var(--nav-h) + 1rem);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(16,185,129,.2);
    border: 1px solid rgba(16,185,129,.4);
    color: #6ee7b7;
    padding: .5rem 1.2rem;
    border-radius: 99px;
    font-size: .82rem;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
    backdrop-filter: blur(8px);
    white-space: nowrap;
}
.toast-notify.show { opacity: 1; }

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp .4s ease both; }

@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}
.shimmer {
    background: linear-gradient(90deg, var(--card-bg) 25%, rgba(255,255,255,.08) 50%, var(--card-bg) 75%);
    background-size: 200% auto;
    animation: shimmer 1.8s linear infinite;
}

/* Leadership tier colors */
.tier-bronze  { color: #cd7f32; }
.tier-silver  { color: #c0c0c0; }
.tier-gold    { color: var(--gold); }
.tier-diamond { color: var(--cyan); }
