* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #0f0f1a;
    --card: #1a1a2e;
    --card2: #16213e;
    --accent: #7c3aed;
    --accent2: #a855f7;
    --gold: #f59e0b;
    --diamond: #06b6d4;
    --green: #10b981;
    --red: #ef4444;
    --text: #f1f5f9;
    --text2: #94a3b8;
    --border: #2d2d4a;
    --radius: 16px;
    --shadow: 0 4px 24px rgba(124,58,237,0.15);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    direction: rtl;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ─── Header ─────────────────────────────────── */
.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent2), var(--diamond));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-name {
    font-size: 14px;
    color: var(--text2);
}

/* ─── Balance Cards ───────────────────────────── */
.balance-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.balance-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.balance-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.balance-card.coin::before { background: linear-gradient(90deg, var(--gold), #fbbf24); }
.balance-card.diamond::before { background: linear-gradient(90deg, var(--diamond), #818cf8); }

.balance-icon { font-size: 28px; margin-bottom: 4px; }
.balance-amount {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 2px;
}
.balance-card.coin .balance-amount { color: var(--gold); }
.balance-card.diamond .balance-amount { color: var(--diamond); }
.balance-label { font-size: 12px; color: var(--text2); }

/* ─── VIP Badge ───────────────────────────────── */
.vip-badge {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border-radius: 12px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 16px 0;
}

.vip-badge .vip-icon { font-size: 24px; }
.vip-badge .vip-text { flex: 1; }
.vip-badge .vip-title { font-size: 14px; font-weight: 700; }
.vip-badge .vip-expire { font-size: 11px; color: rgba(255,255,255,0.7); }

/* ─── Tabs ────────────────────────────────────── */
.tabs {
    display: flex;
    background: var(--card);
    margin: 16px;
    border-radius: var(--radius);
    padding: 4px;
    gap: 4px;
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 10px 4px;
    border: none;
    background: transparent;
    color: var(--text2);
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.tab-btn.active {
    background: var(--accent);
    color: white;
    font-weight: 600;
}

/* ─── Content ─────────────────────────────────── */
.content {
    padding: 0 16px 100px;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── Section Title ───────────────────────────── */
.section-title {
    font-size: 14px;
    color: var(--text2);
    margin: 16px 0 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ─── Package Cards ───────────────────────────── */
.packages-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.pkg-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.pkg-card:active { transform: scale(0.97); }

.pkg-card.popular {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.pkg-card.popular::after {
    content: '⭐ پرطرفدار';
    position: absolute;
    top: 6px; left: 6px;
    background: var(--accent);
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 6px;
}

.pkg-icon { font-size: 32px; margin-bottom: 6px; }
.pkg-amount { font-size: 16px; font-weight: 700; color: var(--text); }
.pkg-bonus {
    font-size: 11px;
    color: var(--green);
    margin: 2px 0;
    min-height: 16px;
}
.pkg-price {
    font-size: 13px;
    color: var(--gold);
    font-weight: 600;
    margin-top: 6px;
}

/* ─── VIP Plans ───────────────────────────────── */
.vip-plans { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.vip-plan-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.vip-plan-card:active { transform: scale(0.98); }
.vip-plan-card.best { border-color: var(--gold); }

.vip-plan-icon { font-size: 32px; }
.vip-plan-info { flex: 1; }
.vip-plan-name { font-size: 15px; font-weight: 600; }
.vip-plan-price { font-size: 13px; color: var(--diamond); margin-top: 2px; }
.vip-plan-arrow { color: var(--text2); font-size: 18px; }

/* ─── Transaction List ────────────────────────── */
.tx-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text2);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.tx-list { display: flex; flex-direction: column; gap: 8px; }

.tx-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tx-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.tx-icon.plus { background: rgba(16,185,129,0.15); }
.tx-icon.minus { background: rgba(239,68,68,0.15); }

.tx-info { flex: 1; }
.tx-reason { font-size: 13px; font-weight: 500; }
.tx-date { font-size: 11px; color: var(--text2); margin-top: 2px; }

.tx-amount {
    font-size: 15px;
    font-weight: 700;
}
.tx-amount.plus { color: var(--green); }
.tx-amount.minus { color: var(--red); }

/* ─── Gift List ───────────────────────────────── */
.gift-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.gifts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.gift-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 10px;
    text-align: center;
}

.gift-emoji { font-size: 36px; margin-bottom: 6px; }
.gift-name { font-size: 13px; font-weight: 500; }
.gift-cost { font-size: 12px; color: var(--diamond); margin-top: 4px; }
.gift-date { font-size: 10px; color: var(--text2); margin-top: 4px; }

/* ─── Empty State ─────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text2);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ─── Modal ───────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card2);
    border-radius: 24px 24px 0 0;
    padding: 24px 20px 40px;
    width: 100%;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    border-top: 1px solid var(--border);
}

.modal-overlay.show .modal { transform: translateY(0); }

.modal-handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 20px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    text-align: center;
}

.modal-sub {
    font-size: 13px;
    color: var(--text2);
    text-align: center;
    margin-bottom: 20px;
}

.modal-price {
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    margin-bottom: 20px;
}

.modal-price .price-label { font-size: 12px; color: var(--text2); margin-bottom: 4px; }
.modal-price .price-value { font-size: 28px; font-weight: 700; color: var(--gold); }
.modal-price .price-unit { font-size: 13px; color: var(--text2); }

.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s;
    margin-bottom: 10px;
}

.btn-primary:active { opacity: 0.8; }

.btn-secondary {
    width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--text2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

/* ─── Loading ─────────────────────────────────── */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    gap: 12px;
    color: var(--text2);
}

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

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

/* ─── Toast ───────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14px;
    z-index: 2000;
    transition: transform 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error { border-color: var(--red); color: var(--red); }

/* ─── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar { width: 0; }
