/* =========================================
   FragCity Wallet Page
   ========================================= */

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    background:
        radial-gradient(circle at top, rgba(50, 115, 246, 0.12), transparent 32%),
        radial-gradient(circle at bottom, rgba(14, 165, 233, 0.06), transparent 24%),
        linear-gradient(180deg, #0b1220 0%, #101726 100%);
}

body {
    min-height: 100vh;
}

.wallet-page {
    position: relative;
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 24px 0 64px;
    box-sizing: border-box;
    direction: rtl;
    color: var(--text-main);
    background: transparent;
}

.wallet-page::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at top, rgba(50, 115, 246, 0.10), transparent 34%),
        radial-gradient(circle at bottom, rgba(14, 165, 233, 0.05), transparent 26%),
        linear-gradient(180deg, rgba(8, 13, 24, 1), rgba(12, 18, 30, 1));
}

.wallet-page-header {
    width: min(1450px, calc(100% - 48px));
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wallet-page-heading {
    display: flex;
    align-items: center;
    gap: 14px;
}

.wallet-page-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #3273f6, #5b8cff);
    box-shadow: 0 10px 28px rgba(50, 115, 246, 0.24);
    font-size: 1.2rem;
}

.wallet-page-heading h1 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-main);
}

.wallet-page-heading p {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.wallet-container {
    position: relative;
    width: min(1450px, calc(100% - 48px));
    margin: 0 auto;
    overflow: hidden;
    padding: 28px;
    border: 1px solid rgba(50, 115, 246, 0.16);
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(24, 27, 40, 0.96), rgba(15, 18, 28, 0.96));
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
    animation: walletFadeIn 0.35s ease both;
}

.wallet-container::before {
    content: '';
    position: absolute;
    top: -100px;
    left: -80px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: rgba(50, 115, 246, 0.08);
    filter: blur(5px);
    pointer-events: none;
}

.wallet-balance-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
}

.wallet-balance-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 280px;
    padding: 18px 22px;
    border: 1px solid rgba(46, 213, 115, 0.18);
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(46, 213, 115, 0.08), rgba(24, 27, 40, 0.55));
}

.wallet-balance-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #2ed573;
    background: rgba(46, 213, 115, 0.1);
    font-size: 1.2rem;
}

.wallet-balance-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wallet-balance-label {
    color: #89a697;
    font-size: 0.82rem;
}

.wallet-balance-value {
    color: #58e38b;
    font-size: 1.38rem;
    font-weight: 800;
    line-height: 1.2;
}

.wallet-action-btn,
.wallet-secondary-btn {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 20px;
    border-radius: 14px;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.wallet-action-btn {
    border: 1px solid rgba(50, 115, 246, 0.35);
    color: #fff;
    background: linear-gradient(135deg, #3273f6, #4d84f7);
    box-shadow: 0 9px 24px rgba(50, 115, 246, 0.22);
}

.wallet-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 13px 30px rgba(50, 115, 246, 0.3);
}

.wallet-action-btn:focus-visible,
.wallet-secondary-btn:focus-visible,
.wallet-login-link:focus-visible,
.withdraw-modal-close:focus-visible,
.withdraw-input-wrap input:focus-visible {
    outline: 2px solid #67a0ff;
    outline-offset: 2px;
}

.wallet-secondary-btn {
    border: 1px solid var(--border-color);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.wallet-secondary-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.wallet-section-divider {
    height: 1px;
    margin: 28px 0 24px;
    background: linear-gradient(90deg, transparent, rgba(50, 115, 246, 0.22), transparent);
}

.wallet-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.wallet-section-header h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.08rem;
    font-weight: 800;
}

.wallet-section-header p {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.wallet-transaction-count {
    flex-shrink: 0;
    padding: 7px 11px;
    border: 1px solid rgba(50, 115, 246, 0.18);
    border-radius: 999px;
    color: #7fa8ff;
    background: rgba(50, 115, 246, 0.08);
    font-size: 0.76rem;
    font-weight: 700;
}

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

.transaction-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.transaction-item:last-child {
    border-bottom: 0;
}

.transaction-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    font-size: 0.95rem;
}

.transaction-positive {
    color: #35d978;
}

.transaction-icon.transaction-positive {
    background: rgba(46, 213, 115, 0.1);
}

.transaction-negative {
    color: #ff6371;
}

.transaction-icon.transaction-negative {
    background: rgba(255, 71, 87, 0.1);
}

.transaction-neutral {
    color: #9da4b5;
}

.transaction-icon.transaction-neutral {
    background: rgba(157, 164, 181, 0.1);
}

.transaction-main {
    min-width: 0;
}

.transaction-title {
    color: var(--text-main);
    font-size: 0.92rem;
    font-weight: 650;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transaction-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 0.76rem;
}

.transaction-meta-separator {
    opacity: 0.55;
}

.transaction-amount-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.transaction-amount {
    font-size: 0.92rem;
    font-weight: 800;
    white-space: nowrap;
}

.transaction-status {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.status-success,
.status-completed {
    color: #5fe490;
}

.status-pending {
    color: #f3c75a;
}

.status-failed {
    color: #ff6b78;
}

.wallet-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    padding: 32px 20px;
    text-align: center;
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.015);
}

.wallet-empty-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    border-radius: 16px;
    color: #7fa8ff;
    background: rgba(50, 115, 246, 0.1);
    font-size: 1.15rem;
}

.wallet-empty-state h3 {
    margin: 0;
    color: var(--text-main);
    font-size: 0.98rem;
}

.wallet-empty-state p {
    max-width: 480px;
    margin: 7px 0 18px;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.8;
}

.wallet-login-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid rgba(50, 115, 246, 0.24);
    border-radius: 12px;
    color: #fff;
    background: rgba(50, 115, 246, 0.12);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    transition: background 0.2s ease, transform 0.2s ease;
}

.wallet-login-link:hover {
    transform: translateY(-1px);
    background: rgba(50, 115, 246, 0.2);
}

/* =========================================
   Withdraw Modal
   ========================================= */

.withdraw-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.withdraw-modal.is-open {
    display: flex;
}

.withdraw-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 7, 13, 0.76);
    backdrop-filter: blur(8px);
}

.withdraw-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    padding: 28px;
    border: 1px solid rgba(50, 115, 246, 0.22);
    border-radius: 24px;
    background: linear-gradient(145deg, #181b28, #10131d);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
    animation: fadeInUp 0.24s ease both;
}

.withdraw-modal-close {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.withdraw-modal-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
}

.withdraw-modal-icon {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    border-radius: 15px;
    color: #fff;
    background: linear-gradient(135deg, #3273f6, #5b8cff);
    box-shadow: 0 12px 28px rgba(50, 115, 246, 0.22);
}

.withdraw-modal-heading h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.12rem;
}

.withdraw-modal-heading p {
    margin: 7px 0 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.8;
}

.withdraw-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.withdraw-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.withdraw-field label {
    color: #dce1eb;
    font-size: 0.82rem;
    font-weight: 650;
}

.withdraw-input-wrap {
    position: relative;
}

.withdraw-input-wrap i {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: #7fa8ff;
    pointer-events: none;
}

.withdraw-input-wrap input {
    width: 100%;
    min-height: 46px;
    padding: 0 42px 0 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    outline: none;
    color: var(--text-main);
    background: #131620;
    font: inherit;
    font-size: 0.84rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.withdraw-input-wrap input::placeholder {
    color: #60697d;
}

.withdraw-input-wrap input:focus {
    border-color: rgba(50, 115, 246, 0.7);
    box-shadow: 0 0 0 4px rgba(50, 115, 246, 0.1);
}

.withdraw-result {
    min-height: 22px;
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.7;
}

.withdraw-result.is-error {
    color: #ff6b78;
}

.withdraw-result.is-success {
    color: #5fe490;
}

.withdraw-result.is-loading {
    color: #7fa8ff;
}

.withdraw-form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.withdraw-submit-btn.is-loading {
    pointer-events: none;
    opacity: 0.7;
}

body.withdraw-modal-open {
    overflow: hidden;
}

@keyframes walletFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 720px) {
    .wallet-page {
        width: 100%;
        padding: 16px 0 56px;
    }

    .wallet-page-heading h1 {
        font-size: 1.22rem;
    }

    .wallet-page-header,
    .wallet-container {
        width: min(100% - 24px, 1450px);
    }

    .wallet-container {
        padding: 20px;
        border-radius: 20px;
    }

    .wallet-balance-row {
        align-items: stretch;
        flex-direction: column;
    }

    .wallet-balance-card {
        min-width: 0;
    }

    .wallet-action-btn {
        width: 100%;
    }

    .wallet-section-header {
        flex-direction: column;
        gap: 10px;
    }

    .transaction-item {
        grid-template-columns: 40px minmax(0, 1fr);
        align-items: start;
    }

    .transaction-amount-wrap {
        grid-column: 2;
        align-items: flex-start;
    }

    .withdraw-modal-dialog {
        padding: 24px 20px 20px;
        border-radius: 20px;
    }
}

@media (max-width: 460px) {
    .wallet-page-heading {
        align-items: flex-start;
    }

    .wallet-page-icon {
        width: 42px;
        height: 42px;
        border-radius: 12px;
    }

    .wallet-balance-card {
        padding: 16px;
    }

    .wallet-balance-value {
        font-size: 1.18rem;
    }

    .withdraw-form-actions {
        grid-template-columns: 1fr;
    }
}
