/* ============================================================
   Croplod Wallet — unified with account.croplod.com identity
   ============================================================ */

/* ---------- Wallet hero (dashboard balance card) ---------- */
.wallet-hero {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    padding: 28px 28px 24px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #312e81 0%, #4338ca 55%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 12px 32px rgba(99, 102, 241, .28);
}
.wallet-hero::before {
    content: "";
    position: absolute;
    top: -60px; left: -40px;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}
.wallet-hero::after {
    content: "";
    position: absolute;
    bottom: -80px; right: -30px;
    width: 260px; height: 260px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .08);
}
.wallet-hero-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.wallet-hero-title {
    font-size: 18px;
    font-weight: 800;
}
.wallet-hero-sub {
    margin-top: 4px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, .82);
}
.wallet-croplod-id {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
    backdrop-filter: blur(6px);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
}
.wallet-croplod-id span {
    color: rgba(255, 255, 255, .8);
}
.wallet-croplod-id strong {
    direction: ltr;
    font-family: ui-monospace, monospace;
    font-weight: 700;
}
.wallet-copy-btn {
    border: none;
    background: rgba(255, 255, 255, .2);
    color: #fff;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s ease;
}
.wallet-copy-btn:hover { background: rgba(255, 255, 255, .34); }
.wallet-hero-balance {
    position: relative;
    z-index: 1;
    margin-top: 22px;
}
.wallet-hero-balance-label {
    font-size: 12.5px;
    color: rgba(255, 255, 255, .82);
}
.wallet-hero-balance-value {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 4px;
}
.wallet-hero-balance-value span {
    font-size: 40px;
    font-weight: 900;
    letter-spacing: -.5px;
    line-height: 1.1;
}
.wallet-hero-balance-value small {
    font-size: 15px;
    font-weight: 700;
    color: rgba(255, 255, 255, .85);
}
.wallet-hero-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}
.wallet-hero-actions .btn { border: none; box-shadow: none; }
.wallet-hero-actions .btn-primary {
    background: #fff;
    color: #4f46e5;
}
.wallet-hero-actions .btn-primary:hover { background: #f1f0ff; }
.wallet-hero-actions .btn-secondary {
    background: rgba(255, 255, 255, .16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .24);
}
.wallet-hero-actions .btn-secondary:hover { background: rgba(255, 255, 255, .26); }

/* ---------- Dashboard grid spacing ---------- */
.wallet-dashboard-grid { margin-bottom: 20px; }

/* ---------- Missing stat-card icon variants ---------- */
.stat-card-icon--red {
    background-color: rgba(239, 68, 68, .12);
    color: var(--color-error-500);
}
.stat-card-icon--indigo {
    background-color: rgba(99, 102, 241, .12);
    color: var(--color-primary-500);
}

/* ---------- Chart legend ---------- */
.wallet-chart-legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted, #64748b);
}
.wallet-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wallet-legend-dot {
    display: inline-block;
    width: 9px; height: 9px;
    border-radius: 50%;
}

/* ---------- Tx amounts ---------- */
.wallet-tx-amount {
    font-weight: 800;
    font-size: 14px;
    white-space: nowrap;
    color: var(--color-success-600, #16a34a);
    font-variant-numeric: tabular-nums;
}
.wallet-tx-amount.is-negative { color: var(--color-error-500, #ef4444); }
.wallet-code-amount {
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    color: var(--text-primary, #0f172a);
    font-variant-numeric: tabular-nums;
}

/* ---------- Page head ---------- */
.wallet-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.wallet-page-title { font-size: 22px; font-weight: 800; margin: 0; }
.wallet-page-sub { margin-top: 4px; font-size: 13px; color: var(--text-muted, #64748b); }
.wallet-header-balance {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle, #e5e7eb);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
}
.wallet-header-balance svg { color: var(--color-primary-500); }
.wallet-header-balance strong {
    font-weight: 800;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: var(--color-primary-600, #4f46e5);
}
.wallet-panel-badge {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted, #64748b);
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 6px;
    white-space: nowrap;
}
.wallet-muted { color: var(--text-muted, #64748b); font-size: 13px; }
/* ---------- Filter tabs ---------- */
.wallet-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}
.wallet-filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-muted, #64748b);
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    text-decoration: none;
    transition: all .15s ease;
}
.wallet-filter-tab:hover {
    color: var(--color-primary-600, #4f46e5);
    background: var(--color-primary-50, #eef2ff);
}
.wallet-filter-tab.active {
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}
.wallet-filter-row { margin-top: 12px; }
.wallet-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.wallet-filter-bar .wallet-input { flex: 1 1 160px; min-width: 140px; }

/* ---------- Table ---------- */
.wallet-table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.wallet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.wallet-table th {
    text-align: right;
    padding: 10px 12px;
    font-size: 11.5px;
    font-weight: 800;
    color: var(--text-muted, #64748b);
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
    white-space: nowrap;
}
.wallet-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
    vertical-align: middle;
}
.wallet-table tr:last-child td { border-bottom: none; }
.wallet-table tr:hover td { background: var(--bg-tertiary); }
.wallet-td-muted { color: var(--text-muted, #64748b); font-size: 12.5px; white-space: nowrap; }
.wallet-td-pos { font-weight: 800; color: var(--color-success-600, #16a34a); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wallet-td-neg { font-weight: 800; color: var(--color-error-500, #ef4444); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Pagination ---------- */
.wallet-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle, #e5e7eb);
    margin-top: 8px;
}
.wallet-page-btn {
    padding: 7px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary-600, #4f46e5);
    background: var(--color-primary-50, #eef2ff);
    text-decoration: none;
    transition: background .15s ease;
}
.wallet-page-btn:hover { background: var(--color-primary-100, #e0e7ff); }
.wallet-page-info { font-size: 12.5px; color: var(--text-muted, #64748b); }

/* ---------- Modal ---------- */
.wallet-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(4px);
}
.wallet-modal-backdrop[hidden] { display: none; }
.wallet-modal {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
    overflow: hidden;
}
.wallet-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
}
.wallet-modal-title { font-size: 16px; font-weight: 800; margin: 0; }
.wallet-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-muted, #64748b);
    cursor: pointer;
    transition: background .15s ease;
}
.wallet-modal-close:hover { background: var(--color-error-50, #fef2f2); color: var(--color-error-500); }
.wallet-modal-body { padding: 22px; }

/* ---------- Quick amounts ---------- */
.wallet-quick-amounts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}
.wallet-quick-amount {
    padding: 10px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle, #e5e7eb);
    background: var(--bg-tertiary);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    cursor: pointer;
    transition: all .15s ease;
}
.wallet-quick-amount:hover {
    border-color: var(--color-primary-400, #818cf8);
    background: var(--color-primary-50, #eef2ff);
    color: var(--color-primary-600, #4f46e5);
}

/* ---------- Form elements ---------- */
.wallet-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.wallet-field-label {
    display: block;
    font-size: 12.5px;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--text-primary, #0f172a);
}
.wallet-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.wallet-input:focus {
    outline: none;
    border-color: var(--color-primary-500, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .14);
}
.wallet-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted, #64748b);
    line-height: 1.7;
}
.wallet-link-result-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.wallet-link-result-row .wallet-input { flex: 1; }
.wallet-gift-code {
    flex: 1;
    direction: ltr;
    text-align: left;
    font-family: ui-monospace, monospace;
    font-weight: 800;
    font-size: 15px;
    padding: 11px 14px;
    border-radius: 6px;
    background: var(--color-primary-50, #eef2ff);
    color: var(--color-primary-600, #4f46e5);
    border: 1px dashed var(--color-primary-300, #a5b4fc);
}
/* ---------- Limit boxes ---------- */
.wallet-limit-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--border-subtle, #e5e7eb);
    border-radius: 8px;
    background: var(--bg-tertiary);
}
.wallet-limit-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px; height: 46px;
    flex-shrink: 0;
    border-radius: 8px;
    background: var(--color-primary-50, #eef2ff);
    color: var(--color-primary-500, #6366f1);
}

/* ---------- Alert ---------- */
.wallet-alert {
    padding: 14px 18px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.8;
    margin-bottom: 16px;
}
.wallet-alert p { margin: 0; }
.wallet-alert-warn {
    background: var(--color-warning-50, #fffbeb);
    border: 1px solid rgba(245, 158, 11, .3);
    color: #b45309;
}

/* ---------- Security tips ---------- */
.wallet-security-tips p {
    margin: 0 0 10px;
    padding-right: 16px;
    position: relative;
    font-size: 13px;
    color: var(--text-primary, #0f172a);
    line-height: 1.8;
}
.wallet-security-tips p::before {
    content: "";
    position: absolute;
    right: 0;
    top: 10px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--color-primary-500, #6366f1);
}
.wallet-security-tips p:last-child { margin-bottom: 0; }

/* ---------- Legal pages (rules / terms) ---------- */
.wallet-legal {
    max-width: 820px;
    margin: 0 auto;
}
.wallet-legal-head {
    background: linear-gradient(135deg, #312e81 0%, #4338ca 55%, #4f46e5 100%);
    color: #fff;
    border-radius: 8px;
    padding: 32px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}
.wallet-legal-head::after {
    content: "";
    position: absolute;
    top: -50px; left: -30px;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}
.wallet-legal-head h1 {
    position: relative;
    z-index: 1;
    font-size: 24px;
    font-weight: 900;
    margin: 0 0 10px;
}
.wallet-legal-head p {
    position: relative;
    z-index: 1;
    margin: 0 0 14px;
    font-size: 13.5px;
    line-height: 2;
    color: rgba(255, 255, 255, .88);
}
.wallet-legal-head .wallet-chip {
    position: relative;
    z-index: 1;
    display: inline-block;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .26);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 6px;
}
.wallet-legal-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle, #e5e7eb);
    border-radius: 10px;
    padding: 24px 26px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.wallet-legal-section h2 {
    font-size: 16px;
    font-weight: 800;
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
    color: var(--color-primary-600, #4f46e5);
}
.wallet-legal-section p {
    margin: 0 0 10px;
    font-size: 13.5px;
    line-height: 2.1;
    color: var(--text-primary, #0f172a);
    text-align: justify;
}
.wallet-legal-section p:last-child { margin-bottom: 0; }
.wallet-legal-section ul, .wallet-legal-section ol {
    margin: 0 0 10px;
    padding-right: 20px;
    font-size: 13.5px;
    line-height: 2.1;
}
.wallet-legal-section li { margin-bottom: 6px; }
.wallet-legal-foot {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
    margin-top: 24px;
    line-height: 1.9;
}

/* ---------- Result box (charge result) ---------- */
.wallet-result-box { padding: 12px 0 4px; }
 .wallet-result-icon {
    width: 72px; height: 72px;
    margin: 0 auto;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wallet-result-icon svg { width: 34px; height: 34px; }
.wallet-result-icon.is-success {
    background: rgba(34, 197, 94, .14);
    color: var(--color-success-500);
}
.wallet-result-icon.is-error {
    background: rgba(239, 68, 68, .14);
    color: var(--color-error-500);
}
.wallet-result {
    border-radius: 8px;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle, #e5e7eb);
}

/* ---------- Header balance (top bar) ---------- */
.account-header .wallet-header-balance {
    background: var(--bg-tertiary);
    border: none;
    padding: 6px 12px;
    font-size: 12px;
}
.account-header .wallet-header-balance strong {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .wallet-form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .wallet-hero { padding: 22px 18px 20px; }
    .wallet-hero-balance-value span { font-size: 32px; }
    .wallet-hero-actions { gap: 8px; }
    .wallet-quick-amounts { grid-template-columns: repeat(3, 1fr); }
    .wallet-legal-head { padding: 24px 20px; }
    .wallet-legal-section { padding: 20px; }
    .wallet-page-title { font-size: 19px; }
    .wallet-filter-bar .wallet-input { flex: 1 1 100%; }
}
@media (max-width: 420px) {
    .wallet-quick-amounts { grid-template-columns: repeat(2, 1fr); }
    .wallet-croplod-id { flex-wrap: wrap; }
}

/* ============================================================
   Wallet — Formal look & wallet-scoped overrides
   ============================================================ */

/* Sharp corners for shared components (wallet pages only) */
.wallet-body .btn { border-radius: 6px; }
.wallet-body .btn-sm { border-radius: 5px; }
.wallet-body .account-card { border-radius: 10px; }
.wallet-body .stat-card { border-radius: 10px; }
.wallet-body .stat-card-icon { border-radius: 8px; }
.wallet-body .list-item { border-radius: 8px; }
.wallet-body .badge { border-radius: 4px; }
.wallet-body .account-sidebar-link { border-radius: 8px; }
.wallet-body .account-header-action-btn { border-radius: 8px; }
.wallet-body .empty-state-icon { border-radius: 8px; }

/* ---------- Help / rules boxes ---------- */
.wallet-help {
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-inline-start: 3px solid var(--color-primary-600, #4338ca);
    background: var(--bg-card);
    border-radius: 6px;
    padding: 16px 18px;
    margin: 20px 0 6px;
    font-size: 13px;
    line-height: 1.9;
    color: var(--text-secondary, #475569);
}
.wallet-help-head {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary, #0f172a);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.wallet-help-head svg { flex-shrink: 0; color: var(--color-primary-600, #4338ca); }
.wallet-help ul { margin: 0 0 10px; padding-right: 18px; }
.wallet-help li { margin-bottom: 4px; }
.wallet-help-legal {
    border-top: 1px dashed var(--border-subtle, #e2e8f0);
    padding-top: 10px;
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--text-muted, #64748b);
}
.wallet-help-legal p { margin: 0 0 8px; }
.wallet-help-legal a {
    display: inline-block;
    margin-inline-end: 10px;
    margin-top: 2px;
    font-weight: 700;
    font-size: 12px;
    color: var(--color-primary-600, #4338ca);
    text-decoration: none;
    border: 1px solid var(--border-subtle, #d3d9e3);
    padding: 5px 12px;
    border-radius: 4px;
    background: var(--bg-tertiary, #f8fafc);
}
.wallet-help-legal a:hover { background: var(--bg-hover, #f1f5f9); }

/* ---------- Wallet header ---------- */
.wallet-body .account-header .account-header-brand-text { display: flex; }
.wallet-body .account-header .account-header-actions { gap: 6px; }
.wallet-body .account-header .wallet-header-balance { padding: 5px 10px; }
.wallet-body .account-header .wallet-header-balance span {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: ltr;
}

/* ---------- Responsive (wallet) ---------- */
@media (max-width: 900px) {
    .wallet-help { margin: 16px 0 4px; }
}
@media (max-width: 639px) {
    /* نام سرویس در هدر موبایل نمایش داده نمی‌شود */
    .wallet-body .account-header .account-header-brand-text { display: none; }
    .wallet-body .account-header .wallet-header-balance { padding: 4px 8px; font-size: 11px; }
    .wallet-body .account-header .wallet-header-balance span { max-width: 96px; }
    .wallet-body .account-header .account-header-actions { gap: 4px; }
    .wallet-help { padding: 14px 14px; }
}
@media (max-width: 379px) {
    /* فضا کم است: فقط آیکون موجودی */
    .wallet-body .account-header .wallet-header-balance {
        width: 36px; height: 36px; padding: 0;
        justify-content: center;
        background: transparent;
        border: none;
    }
    .wallet-body .account-header .wallet-header-balance span { display: none; }
}

/* ---------- Dashboard: gift codes & payment links stay side-by-side on mobile ---------- */
@media (max-width: 639px) {
    .wallet-dashboard-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .wallet-dashboard-grid .account-card { padding: 12px; }
    .wallet-dashboard-grid .account-card-header { flex-direction: column; align-items: flex-start; gap: 6px; }
    .wallet-dashboard-grid .account-card-title { font-size: 13px; }
    .wallet-dashboard-grid .btn-sm { padding: 3px 8px; font-size: 10.5px; }
    .wallet-dashboard-grid .list-item { padding: 8px 6px; border-radius: 6px; }
    .wallet-dashboard-grid .list-item-icon { width: 30px; height: 30px; flex-shrink: 0; }
    .wallet-dashboard-grid .list-item-icon svg, .wallet-dashboard-grid .list-item-icon .icon { width: 15px; height: 15px; }
    .wallet-dashboard-grid .list-item-title { font-size: 11px; overflow-wrap: anywhere; word-break: break-all; }
    .wallet-dashboard-grid .list-item-desc { font-size: 10px; }
    .wallet-dashboard-grid .wallet-code-amount { font-size: 10.5px; }
    .wallet-dashboard-grid .empty-state { padding: 10px 6px; }
    .wallet-dashboard-grid .empty-state-title { font-size: 12px; }
    .wallet-dashboard-grid .empty-state-desc { font-size: 10px; }
}
@media (max-width: 379px) {
    .wallet-dashboard-grid { gap: 8px; }
    .wallet-dashboard-grid .account-card { padding: 10px 8px; }
}
