*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --bg-body: #1a202c;
    --bg-card: #2d3748;
    --bg-toggle: #334155; 
    --color-primary: #f59e0b;
    --color-text: #ffffff;
    --color-text-muted: #cbd5e1;
    --border-color: #475569;
    --color-success: #48bb78; 
    --color-warning-bg: rgba(197, 48, 48, 0.1); 
    --color-warning-border: rgba(197, 48, 48, 0.3);
    --color-warning-text: #f56565;
    --color-danger: #e53e3e;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--bg-body);
    color: var(--color-text);
    margin: 0;
    padding: 1.5rem 1.5rem 80px 1.5rem; 
    overflow-x: hidden;
}

.page { display: none; width: 100%; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.top-header { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 1rem; }
.main-title { font-size: 1.5rem; font-weight: 700; margin: 0; color: var(--color-text); }
.sub-title { font-size: 1.1rem; font-weight: 600; margin: 0.5rem 1.5rem 0 0; color: var(--color-text-muted); }

/* صفحه پروفایل کاربری */
.profile-container { background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; padding: 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; }
.profile-header-info { display: flex; align-items: center; gap: 15px; border-bottom: 1px solid var(--border-color); padding-bottom: 1.5rem; }
.user-avatar { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 2px solid var(--color-primary); background-color: var(--bg-toggle);  }
.user-details { display: flex; flex-direction: column; }
.user-name { font-size: 1.2rem; font-weight: 700; }
.user-id { font-size: 0.85rem; color: var(--color-text-muted); direction: ltr; text-align: right; margin-top: 0.2rem; }
.profile-stats { display: flex; flex-direction: column; gap: 1rem; }
.stat-row { display: flex; justify-content: space-between; align-items: center; background-color: var(--bg-body); padding: 1rem; border-radius: 6px; border: 1px solid var(--border-color); }
.stat-label { font-size: 0.9rem; color: var(--color-text-muted); }
.stat-value { font-size: 1.1rem; font-weight: 700; direction: ltr; }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }

/* گرید و کارت‌های پلن */
.pricing-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; }
.card { background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; width: calc(33.333% - 10px);  }
.card-header { background-color: var(--color-primary); color: #fff; text-align: center; padding: 1.25rem 0.5rem; }
.card-header h3 { margin: 0 0 0.25rem 0; font-size: 1.1rem; font-weight: 600; direction: ltr; }
.card-header .price { font-size: 1.5rem; font-weight: bold; direction: ltr; }
.card-header .price span { font-size: 0.8rem; font-weight: normal; }
.toggle-btn { background-color: var(--bg-toggle); padding: 0.75rem 0.5rem; display: flex; justify-content: center; align-items: center; gap: 5px; cursor: pointer; border-bottom: 1px solid var(--border-color); user-select: none; transition: background-color 0.2s; }
.toggle-btn:hover { background-color: #3f4e66; }
.toggle-btn .text { font-size: 0.9rem; font-weight: 600; }
.toggle-btn .arrow { display: flex; align-items: center; transition: transform 0.3s ease; }
.toggle-btn.active .arrow { transform: rotate(180deg); }
.collapse-content { max-height: 0; overflow: hidden; transition: max-height 0.4s ease-out; }
.collapse-content.open { max-height: 1000px; }
.card-body { padding: 1.25rem 0.75rem; }
.card-body ul { list-style: none; padding: 0; margin: 0; }
.card-body li { padding: 0.5rem 0; border-bottom: 1px dashed var(--border-color); font-size: 0.85rem; display: flex; align-items: center; }
.card-body li:last-child { border-bottom: none; }
.card-body li::before { content: "•"; color: #fff; margin-left: 0.4rem; font-size: 1.2rem; }
.description-text { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 1rem; line-height: 1.6; text-align: justify; display: flex; align-items: flex-start; }
.description-text::before { content: "•"; color: #fff; margin-left: 0.4rem; font-size: 1rem; margin-top: -2px; }
.card-footer { padding: 1rem; background-color: var(--bg-card); border-top: 1px solid var(--border-color); margin-top: auto; }
.buy-btn { background-color: var(--color-primary); color: #fff; width: 100%; padding: 0.75rem; border: none; border-radius: 4px; font-family: inherit; font-weight: bold; font-size: 1rem; cursor: pointer; transition: background-color 0.2s; }
.buy-btn:hover { background-color: #d97706; }

/* کادرهای عمومی (واریز، برداشت، رفرال) */
.deposit-header { display: flex; justify-content: flex-start; margin-bottom: 1.5rem; }
.deposit-title-btn { background-color: var(--color-primary); color: #fff; padding: 0.7rem 1.5rem; border-radius: 4px; font-size: 1.1rem; font-weight: 700; border: none; }
.deposit-container { width: 100%; max-width: 500px; margin: 0 auto; }
.status-indicator { font-size: 0.85rem; margin-bottom: 1rem; text-align: right; color: var(--color-success); }
.deposit-card { background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; padding: 2rem 1.5rem; margin-bottom: 1.5rem; text-align: center; }
.section-title { font-size: 1.1rem; font-weight: 600; color: var(--color-text-muted); margin-bottom: 1rem; }
.address-box { background-color: #1a202c; color: var(--color-text); border: 1px solid var(--border-color); border-radius: 4px; padding: 0.8rem 1rem; font-family: 'Vazirmatn', sans-serif; font-size: 0.95rem; direction: ltr; margin-bottom: 1.5rem; width: 100%; text-align: center; word-break: break-all; }
.deposit-buttons { display: flex; justify-content: center; margin-bottom: 2rem; }
.copy-address-btn { width: 100%; padding: 0.75rem; border: none; border-radius: 4px; font-family: inherit; font-weight: 600; font-size: 1rem; cursor: pointer; transition: background-color 0.2s; display: flex; align-items: center; justify-content: center; gap: 5px; background-color: var(--color-primary); color: #fff; }
.copy-address-btn:hover { background-color: #d97706; }
.copy-address-btn svg { width: 18px; height: 18px; fill: currentColor; }
.qr-text { font-size: 0.95rem; color: var(--color-text-muted); margin-bottom: 1rem; }
.qr-code-box { width: 200px; height: 200px; margin: 0 auto; border-radius: 8px; background-color: #ffffff; padding: 10px; display: flex; align-items: center; justify-content: center; }
.qr-code-box img { width: 100%; height: 100%; object-fit: contain; }
.warning-box { background-color: var(--color-warning-bg); border: 1px solid var(--color-warning-border); border-radius: 6px; padding: 1rem; color: var(--color-warning-text); font-size: 0.85rem; text-align: justify; margin-top: 1.5rem; width: 100%; display: flex; align-items: center; gap: 10px; }
.warning-icon { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }

/* اختصاصی صفحه برداشت و رفرال */
.withdraw-container { max-width: 450px; padding-bottom: 2rem; }
.withdraw-stats-top { margin-bottom: 1rem; padding: 0; }
.stat-box.full-width { width: 100%; background-color: rgba(245, 158, 11, 0.05); border: 1px solid rgba(245, 158, 11, 0.2); }
.large-value { font-size: 2rem; margin-bottom: 0.3rem; }
.withdraw-stats-middle { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 1.5rem; }
.stat-box-small { flex: 1; background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 6px; padding: 1rem; text-align: center; display: flex; flex-direction: column-reverse; align-items: center; }
.small-label { font-size: 0.8rem; color: var(--color-text-muted); }
.small-value { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.2rem; }
.withdraw-input { border: 1px solid var(--border-color) !important; background-color: transparent !important; color: #fff !important; border-radius: 6px !important; padding: 1rem !important; font-size: 1rem !important; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.withdraw-input:focus { border-color: #2196F3 !important; box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2); }
.withdraw-form .section-title { color: var(--color-text); margin-top: 0; }

/* پاپ‌آپ (Modal) موجودی ناکافی */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); z-index: 2000; justify-content: center; align-items: center; animation: fadeIn 0.2s ease; }
.modal-content { background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; padding: 2rem 1.5rem; width: 90%; max-width: 350px; text-align: center; box-shadow: 0 10px 25px rgba(0,0,0,0.5); }
.modal-icon { width: 50px; height: 50px; fill: var(--color-warning-text); margin-bottom: 1rem; }
.modal-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--color-text); }
.modal-text { font-size: 0.9rem; color: var(--color-text-muted); margin-bottom: 1.5rem; line-height: 1.6; }
.modal-buttons { display: flex; gap: 10px; }
.modal-btn { flex: 1; padding: 0.75rem; border: none; border-radius: 4px; font-family: inherit; font-weight: 600; font-size: 0.95rem; cursor: pointer; transition: background-color 0.2s; }
.modal-btn-cancel { background-color: var(--bg-toggle); color: #fff; }
.modal-btn-cancel:hover { background-color: #3f4e66; }
.modal-btn-deposit { background-color: var(--color-primary); color: #fff; }
.modal-btn-deposit:hover { background-color: #d97706; }

/* منوی ناوبری ثابت */
.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; background-color: var(--bg-card); border-top: 1px solid var(--border-color); display: flex; justify-content: space-around; align-items: center; padding: 0.6rem 0; z-index: 1000; box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3); }
.nav-item { display: flex; flex-direction: column; align-items: center; color: var(--color-text-muted); text-decoration: none; font-size: 0.75rem; font-weight: 600; gap: 5px; cursor: pointer; transition: color 0.3s; }
.nav-item:hover, .nav-item.active { color: var(--color-primary); }
.nav-item svg { width: 24px; height: 24px; fill: currentColor; transition: transform 0.2s; }
.nav-item:active svg { transform: scale(0.9); }

/* تنظیمات ریسپانسیو */
@media (max-width: 600px) {
    body { padding: 0.5rem 0.5rem 70px 0.5rem; }
    .top-header { margin-bottom: 1rem; }
    .main-title { font-size: 1.2rem; }
    .sub-title { font-size: 0.9rem; margin: 0.2rem 1rem 0 0; }
    .pricing-grid { gap: 8px; }
    .card { width: calc(33.333% - 5.34px); }
    .card-header { padding: 0.6rem 0.2rem; }
    .card-header h3 { font-size: 0.75rem; }
    .card-header .price { font-size: 1rem; }
    .card-header .price span { display: block; font-size: 0.65rem; margin-top: 2px; }
    .toggle-btn { padding: 0.5rem 0.2rem; gap: 3px; }
    .toggle-btn .text { font-size: 0.65rem; }
    .toggle-btn .arrow svg { width: 12px; height: 12px; }
    .card-body { padding: 0.6rem 0.4rem; }
    .card-body li { padding: 0.4rem 0; font-size: 0.65rem; }
    .card-body li::before { font-size: 0.8rem; margin-left: 0.2rem; }
    .description-text { font-size: 0.55rem; margin-top: 0.6rem; }
    .description-text::before { font-size: 0.7rem; margin-left: 0.2rem; }
    .card-footer { padding: 0.5rem; }
    .buy-btn { padding: 0.4rem; font-size: 0.8rem; }
    .nav-item { font-size: 0.65rem; }
    .nav-item svg { width: 22px; height: 22px; }
    .deposit-header { margin-bottom: 1rem; }
    .deposit-title-btn { font-size: 1rem; padding: 0.6rem 1rem; }
    .deposit-card { padding: 1.5rem 1rem; }
    .address-box { font-size: 0.8rem; padding: 0.6rem; }
    .deposit-buttons { gap: 0.5rem; }
    .copy-address-btn { font-size: 0.9rem; padding: 0.6rem; }
    .qr-code-box { width: 170px; height: 170px; }
    .profile-container { padding: 1rem; }
    .user-avatar { width: 50px; height: 50px; }
    .user-name { font-size: 1.1rem; }
    .stat-value { font-size: 1rem; }
    .large-value { font-size: 1.5rem; }
    .withdraw-stats-middle { gap: 5px; }
    .stat-box-small { padding: 0.6rem; }
    .small-value { font-size: 1rem; }
    .small-label { font-size: 0.7rem; }
    .withdraw-input { padding: 0.8rem !important; }
}