/**
 * Chatr Danesh Referral & Wallet - Public Styles
 * Designed for sleek Persian RTL presentation
 */

/* مخفی‌سازی پیام‌های ارجاع تکراری یا قدیمی */
div#raf-message {
    display: none !important;
}

/* استایل آیکون‌های وکتوری SVG */
.chd-icon {
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
    flex-shrink: 0;
}

.chd-stat-svg {
    color: #1a2b49;
    vertical-align: middle;
}

.chd-hero-svg {
    color: #d4af37;
    opacity: 0.9;
}

.chd-empty-svg {
    color: #cbd5e1;
    margin-bottom: 12px;
}

.chd-btn-svg,
.chd-tab-svg {
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
}

.chd-inline-svg {
    display: inline-block;
    vertical-align: -2px;
    margin-left: 4px;
}

.chd-heading-svg,
.chd-widget-svg,
.chd-modal-svg {
    display: inline-block;
    vertical-align: -3px;
    margin-left: 8px;
}


.chd-referral-wrapper {
    font-family: inherit;
    direction: rtl;
    text-align: right;
    color: #2d3748;
    margin: 20px 0;
}

/* Hero Banner */
.chd-hero-card {
    background: linear-gradient(135deg, #101c36 0%, #1c3258 100%);
    color: #ffffff;
    border-radius: 14px;
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 25px rgba(16, 28, 54, 0.15);
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
}

.chd-hero-card::after {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.2) 0%, transparent 70%);
    border-radius: 50%;
}

.chd-hero-content {
    max-width: 80%;
    z-index: 1;
}

.chd-hero-content h2 {
    color: #ffffff !important;
    font-size: 22px;
    font-weight: 800;
    margin: 10px 0 8px;
}

.chd-hero-content p {
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.8;
    margin: 0;
}

.chd-badge-gold {
    background: rgba(212, 175, 55, 0.2);
    color: #f6d365;
    border: 1px solid #d4af37;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.chd-hero-icon {
    font-size: 55px;
    z-index: 1;
    opacity: 0.9;
}

/* Stats Cards Grid */
.chd-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 25px;
}

.chd-stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.chd-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.chd-card-wallet {
    background: #fffdf5;
    border: 1px solid #e8d087;
    position: relative;
}

.chd-card-negative {
    background: #fff5f5;
    border-color: #feb2b2;
}

.chd-stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.chd-stat-title {
    font-size: 14px;
    color: #718096;
    font-weight: 600;
}

.chd-stat-icon {
    font-size: 24px;
}

.chd-stat-value {
    font-size: 26px;
    font-weight: 800;
    color: #1a2b49;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.chd-card-wallet .chd-stat-value {
    color: #27ae60;
}

.chd-card-negative .chd-stat-value {
    color: #e53e3e;
}

.chd-stat-value small {
    font-size: 14px;
    font-weight: normal;
    color: #a0aec0;
}

.chd-stat-hint {
    font-size: 12px;
    color: #a0aec0;
    margin: 0 0 15px 0;
    line-height: 1.5;
}

.chd-text-danger {
    color: #e53e3e !important;
}

.chd-stat-actions {
    margin-top: auto;
}

/* Buttons */
.chd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    width: 100%;
}

.chd-btn-gold {
    background: linear-gradient(135deg, #d4af37 0%, #b8972b 100%);
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(212, 175, 55, 0.3);
}

.chd-btn-gold:hover:not(:disabled) {
    background: linear-gradient(135deg, #b8972b 0%, #9a7d20 100%);
    color: #ffffff !important;
}

.chd-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #cbd5e0 !important;
    color: #718096 !important;
    box-shadow: none !important;
}

.chd-btn-secondary {
    background: #edf2f7;
    color: #4a5568;
}

.chd-btn-secondary:hover {
    background: #e2e8f0;
}

/* Share & QR Box */
.chd-share-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.chd-share-grid {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 30px;
    align-items: center;
}

@media (max-width: 768px) {
    .chd-share-grid {
        grid-template-columns: 1fr;
    }
    .chd-hero-card {
        flex-direction: column;
        text-align: center;
    }
    .chd-hero-content {
        max-width: 100%;
    }
    .chd-hero-icon {
        margin-top: 15px;
    }
}

.chd-share-links h3 {
    margin: 0 0 8px 0;
    color: #1a2b49;
    font-size: 18px;
    font-weight: 700;
}

.chd-share-links p {
    color: #718096;
    font-size: 13px;
    margin-bottom: 18px;
}

.chd-copy-group {
    margin-bottom: 15px;
}

.chd-copy-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 6px;
}

.chd-input-copy {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.chd-input-copy:focus-within {
    border-color: #d4af37;
}

.chd-input-copy input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 14px;
    font-size: 13px;
    color: #2d3748;
    outline: none;
    direction: ltr;
    text-align: left;
}

.chd-code-text {
    font-weight: 800;
    letter-spacing: 2px;
    color: #1a2b49 !important;
    font-family: monospace, sans-serif;
    font-size: 15px !important;
}

.chd-copy-btn {
    background: #1a2b49;
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.chd-copy-btn:hover {
    background: #d4af37;
}

/* Social Share */
.chd-social-share {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.chd-social-label {
    font-size: 12px;
    color: #718096;
    font-weight: 600;
}

.chd-social-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.15s ease;
    color: #fff !important;
}

.chd-social-btn:hover {
    transform: translateY(-2px);
    color: #fff !important;
}

.chd-btn-tg { background: #0088cc; }
.chd-btn-wa { background: #25d366; }
.chd-btn-sms { background: #4a5568; }

/* QR Code Card */
.chd-qr-card {
    background: #f8fafc;
    border: 1px dashed #cbd5e0;
    border-radius: 12px;
    padding: 18px;
    text-align: center;
}

.chd-qr-card h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #1a2b49;
}

.chd-qr-image-wrapper {
    background: #ffffff;
    padding: 12px;
    border-radius: 8px;
    display: inline-block;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
}

.chd-qr-image-wrapper img,
.chd-qr-image-wrapper canvas {
    display: block;
    margin: 0 auto;
}

.chd-qr-card small {
    display: block;
    font-size: 11px;
    color: #718096;
}

/* Tabs Section */
.chd-tabs-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.chd-tabs-nav {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #edf2f7;
    margin-bottom: 20px;
    overflow-x: auto;
}

.chd-tab-btn {
    background: transparent;
    border: none;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    color: #718096;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color 0.2s;
}

.chd-tab-btn:hover {
    color: #1a2b49;
}

.chd-tab-btn.active {
    color: #1a2b49;
}

.chd-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    left: 0;
    height: 2px;
    background: #d4af37;
}

.chd-tab-pane {
    display: none;
}

.chd-tab-pane.active {
    display: block;
}

/* Tables */
.chd-table-responsive {
    overflow-x: auto;
}

.chd-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.chd-table th {
    background: #f8fafc;
    color: #4a5568;
    font-weight: 700;
    padding: 12px 14px;
    border-bottom: 2px solid #e2e8f0;
    text-align: right;
    white-space: nowrap;
}

.chd-table td {
    padding: 14px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: middle;
}

.chd-table tr:hover td {
    background: #fdfbf7;
}

.chd-phone-tag,
.chd-email-tag {
    background: #edf2f7;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: monospace, sans-serif;
    font-size: 12px;
    color: #1a2b49;
    direction: ltr;
    display: inline-block;
    margin-top: 3px;
}

.chd-user-name {
    color: #1a2b49;
    font-size: 13px;
    font-weight: 700;
}

.chd-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.chd-status-registered { background: #e2e8f0; color: #4a5568; }
.chd-status-purchased { background: #bee3f8; color: #2b6cb0; }
.chd-status-pending { background: #feebc8; color: #c05621; }
.chd-status-rewarded { background: #c6f6d5; color: #22543d; }
.chd-status-refunded { background: #fed7d7; color: #9b2c2c; }

.chd-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
}
.chd-pill-success { background: #f0fff4; color: #27ae60; border: 1px solid #c6f6d5; }
.chd-pill-warning { background: #fffaf0; color: #dd6b20; border: 1px solid #feebc8; }
.chd-pill-danger { background: #fff5f5; color: #e53e3e; border: 1px solid #fed7d7; }
.chd-pill-default { background: #f7fafc; color: #718096; }

.chd-reward-amount {
    color: #27ae60;
    font-weight: 800;
}

.chd-text-success { color: #27ae60; }
.chd-text-danger { color: #e53e3e; }
.chd-text-muted { color: #a0aec0; }
.chd-date-cell { color: #718096; font-size: 12px; }

/* Empty States */
.chd-empty-state {
    text-align: center;
    padding: 40px 20px;
}

.chd-empty-icon {
    font-size: 45px;
    display: block;
    margin-bottom: 12px;
}

.chd-empty-state h4 {
    color: #1a2b49;
    font-size: 16px;
    margin: 0 0 8px 0;
}

.chd-empty-state p {
    color: #718096;
    font-size: 13px;
    max-width: 400px;
    margin: 0 auto;
}

/* Modal Overlay & Dialog */
.chd-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.chd-modal-container {
    background: #ffffff;
    border-radius: 14px;
    width: 100%;
    max-width: 550px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    overflow: hidden;
    animation: chdFadeIn 0.25s ease;
}

@keyframes chdFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.chd-modal-header {
    background: #1a2b49;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chd-modal-header h3 {
    color: #fff !important;
    font-size: 16px;
    margin: 0;
}

.chd-modal-close {
    background: transparent;
    border: none;
    color: #cbd5e0;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.chd-modal-close:hover {
    color: #fff;
}

.chd-modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.chd-modal-footer {
    padding: 15px 20px;
    background: #f8fafc;
    border-top: 1px solid #edf2f7;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.chd-modal-footer .chd-btn {
    width: auto;
}

/* Forms */
.chd-form-group {
    margin-bottom: 15px;
}

.chd-form-row {
    display: flex;
    gap: 15px;
}

.chd-col-6 {
    flex: 1;
}

.chd-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 6px;
}

.chd-required {
    color: #e53e3e;
}

.chd-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.chd-input:focus {
    border-color: #d4af37;
}

.chd-amount-input-wrap {
    display: flex;
    gap: 8px;
}

.chd-btn-all {
    background: #edf2f7;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    white-space: nowrap;
}

.chd-btn-all:hover {
    background: #e2e8f0;
}

.chd-field-hint {
    display: block;
    font-size: 11px;
    color: #718096;
    margin-top: 4px;
}

.chd-sheba-input-group {
    display: flex;
    align-items: center;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
}

.chd-sheba-prefix {
    padding: 0 12px;
    font-weight: 700;
    color: #1a2b49;
    background: #e2e8f0;
    height: 100%;
    display: flex;
    align-items: center;
}

.chd-sheba-input-group .chd-input {
    border: none;
    background: transparent;
}

.chd-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 15px;
    line-height: 1.6;
}

.chd-alert-info { background: #ebf8ff; border: 1px solid #bee3f8; color: #2b6cb0; }
.chd-alert-success { background: #f0fff4; border: 1px solid #c6f6d5; color: #27ae60; }
.chd-alert-danger { background: #fff5f5; border: 1px solid #fed7d7; color: #e53e3e; }
.chd-alert-warning { background: #fffaf0; border: 1px solid #feebc8; color: #c05621; }
