/* Wallet popup on /play. The markup and behaviour live in
   client_new/scripts/components/WalletModal.js; /wallet/deposit,
   /wallet/withdraw and /wallet/tip render play.html with the modal open on
   the matching tab, exactly like /vault and /investment.

   The overlay, frame and close button come from user-profile-modal.css.
   This file widens the frame, lays out the single-column wallet panel and
   lets the deposit/withdraw/transfer cards keep the look they have on the
   account pages. */

.wallet-modal {
    width: 95%;
    max-width: 600px;
}

/* The component sets the overlay's top padding to the gap the old centred
   layout used. Anchoring the panel at that fixed gap lets a history grow
   downwards without moving the stats section, while the overlay stays the
   only scroll container (right page edge), like /security and /investment. */
.wallet-modal-overlay {
    align-items: flex-start;
}

.wallet-modal-overlay .wallet-modal {
    margin: 0 auto;
}

.wallet-modal * { box-sizing: border-box; }

.wallet-modal .user-profile-modal-body { padding: 12px 20px 20px; }

.wallet-columns {
    grid-template-columns: 1fr;
}

/* The right side holds the same .stats-section / .withdrawal-dashboard /
   .transfer-dashboard blocks the account pages use, so the shell panel
   itself stays transparent and padding-free to avoid a card inside a card. */
.wallet-right {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.wallet-right .stats-section,
.wallet-right .withdrawal-dashboard,
.wallet-right .transfer-dashboard {
    margin: 0;
}

.wallet-right .withdrawal-dashboard,
.wallet-right .transfer-dashboard {
    gap: 20px;
}

/* The shared cards draw a top accent line and lift on hover on the account
   pages. The wallet panel is flat and static, so neutralise both here without
   changing the site-wide rules. */
.wallet-modal .stats-section::before,
.wallet-modal .withdrawal-form-section::before,
.wallet-modal .transfer-form-section::before {
    display: none;
}

.wallet-modal .stats-section:hover,
.wallet-modal .withdrawal-form-section:hover,
.wallet-modal .transfer-form-section:hover {
    transform: none;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Deposit tab: the address card and the Recent Transactions card stack. */
.wallet-deposit-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Inline success/error messages were replaced by the same top-centre notice
   /security uses, so there is no reserved line above the forms any more. */

/* The wrapper is always present so the panel keeps one stable DOM shape;
   only the .is-loading modifier hides the info. The popup opens at the
   final size of the active tab with the shared glance sweeping over the
   card shells until /wallet.json lands, exactly like the other popups. */
.wallet-loading {
    position: relative;
}

.wallet-loading.is-loading {
    overflow: hidden;
    pointer-events: none;
}

.wallet-loading.is-loading > *:not(.modal-skeleton-glance) {
    visibility: hidden;
}

/* Keep the card shells visible as empty panels: the .stats-section and the
   history .wallet-ledger on the deposit tab, plus the form-section
   counterparts on withdraw and tip. Only their contents stay hidden. */
.wallet-loading.is-loading .stats-section,
.wallet-loading.is-loading .withdrawal-form-section,
.wallet-loading.is-loading .transfer-form-section,
.wallet-loading.is-loading .wallet-ledger {
    visibility: visible;
}

.wallet-loading.is-loading .stats-section > *,
.wallet-loading.is-loading .withdrawal-form-section > *,
.wallet-loading.is-loading .transfer-form-section > *,
.wallet-loading.is-loading .wallet-ledger > * {
    visibility: hidden;
}

.wallet-error { padding: 4px; }

/* The account pages give these sections their own padding; inside the popup
   the right column is narrower, so trim it a little. */
.wallet-right .withdrawal-form-section,
.wallet-right .transfer-form-section {
    padding: 24px;
}

.wallet-right .deposit-card { margin: 0; }

/* Deposit tab: stack the QR above the address in one centred column so the
   pair reads as a single deposit card instead of two side-by-side blocks. */
.wallet-right .deposit-card {
    grid-template-columns: 1fr;
    gap: 20px;
}

.wallet-right .address-section { width: 100%; }
.wallet-right .address-label { text-align: center; }

/* The copy control sits inside the address field as an icon-only button. */
.wallet-right .address-container {
    position: relative;
    display: block;
    margin-bottom: 16px;
}

.wallet-right .address-input {
    width: 100%;
    padding-right: 52px;
}

.wallet-right .copy-btn {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 6px;
    margin: auto 0;
    width: 34px;
    height: 34px;
    padding: 0;
    gap: 0;
    border-radius: 8px;
    justify-content: center;
}

.wallet-right .copy-btn:hover { transform: none; }

/* The withdraw address label uses the Bitcoin mark instead of a generic map
   pin; keep it aligned with the label text. */
.wallet-modal .form-label img {
    display: block;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* The tab strip under the deposit card is a click target, so give it a
   pointer and keep the selected coin visibly selected. */
.wallet-right .crypto-column-item { cursor: pointer; }
.wallet-right .crypto-column-item.active {
    background: linear-gradient(145deg, rgba(0, 255, 204, 0.22), rgba(0, 255, 204, 0.08));
    color: #00ffcc;
}

/* Phones: tighten the panel padding and keep the card headings in scale with
   the rest of the wallet (the shared rule bumps them to 1.2rem). */
@media (max-width: 640px) {
    .wallet-modal .user-profile-modal-body { padding: 10px; }
    .wallet-modal .section-title { font-size: 1rem; margin-bottom: 14px; }
    .wallet-right .withdrawal-form-section,
    .wallet-right .transfer-form-section { padding: 18px; }
}

/* ---------------------------------------------------------------------------
   History ledger
   One collapsible card shared by Recent Transactions, Withdrawal History and
   Transfer History. Collapsed it is a single 56px row; open it expands in
   normal flow and the popup's overlay scrolls at the page edge.
--------------------------------------------------------------------------- */

.wallet-ledger {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* The list expands below the summary row in normal flow. The panel is
   top-anchored and the overlay is the scroll container, so the history grows
   downwards without moving the stats section above and the scrollbar stays
   on the right page edge. */
.wallet-ledger-body {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.wallet-ledger-head {
    width: 100%;
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    background: transparent;
    border: 0;
    border-radius: 15px 15px 0 0;
    color: #fff;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
}

.wallet-ledger-head:hover { background: rgba(0, 255, 204, 0.04); }

.wallet-ledger-head:focus-visible {
    outline: 2px solid rgba(0, 255, 204, 0.6);
    outline-offset: -2px;
}

.wallet-ledger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 8px;
    font-size: 12px;
    color: #979797;
}

.wallet-ledger-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wallet-ledger-chevron {
    margin-left: auto;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    transition: transform 0.25s ease, color 0.25s ease;
}

.wallet-ledger.is-open .wallet-ledger-chevron {
    transform: rotate(180deg);
    color: rgba(255, 255, 255, 0.55);
}

/* Each history entry reads top-to-bottom on its own: what happened and when
   on the left, the amount on the right, and the state underneath it. */
.wallet-entry {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    grid-template-areas:
        'icon main amount'
        'icon main status';
    align-items: center;
    column-gap: 12px;
    min-height: 54px;
    padding: 9px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.2s ease;
}

.wallet-entry:first-child { border-top: 0; }

.wallet-entry:hover { background: rgba(0, 255, 204, 0.04); }

.wallet-entry-icon {
    grid-area: icon;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 11px;
}

.wallet-entry-icon.is-in {
    color: #00ffcc;
    background: rgba(0, 255, 204, 0.1);
    border: 1px solid rgba(0, 255, 204, 0.25);
}

.wallet-entry-icon.is-out {
    color: #f97f7f;
    background: rgba(249, 127, 127, 0.1);
    border: 1px solid rgba(249, 127, 127, 0.25);
}

/* Deposits show the coin mark instead of the generic arrow, so the row reads
   as BTC/LTC at a glance. */
.wallet-entry-icon.is-coin {
    background: none;
    border: 0;
}
.wallet-entry-coin {
    display: block;
    width: 22px;
    height: 22px;
}

.wallet-entry-main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.wallet-entry-label {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wallet-entry-sub {
    margin-top: 2px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wallet-entry-amount {
    grid-area: amount;
    justify-self: end;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.wallet-entry-amount.is-in { color: #00ffcc; }

.wallet-entry-amount.is-out { color: #f97f7f; }

.wallet-entry-status {
    grid-area: status;
    justify-self: end;
}

.wallet-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    text-decoration: none;
}

.wallet-chip::before {
    content: '';
    flex: 0 0 5px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #00ffcc;
}

.wallet-chip.is-ok::before { background: #00ffcc; }

.wallet-chip.is-pending::before { background: #f39c12; }

.wallet-chip.is-sent::before { background: #00ffcc; }

.wallet-chip .fas { font-size: 8px; }

a.wallet-chip:hover { color: #fff; }

.wallet-ledger-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px 16px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

.wallet-ledger-empty i { color: rgba(0, 255, 204, 0.6); }

@media (max-width: 640px) {
    .wallet-ledger-head { padding: 0 14px; }
    .wallet-entry { padding: 9px 14px; }
    .wallet-entry-amount { font-size: 12px; }
}
