/* ================================================================
   CHECKOUT & WALLET — $ECBT unified checkout + wallet panel
   Namespace: .checkout-* e .wallet-*
   ================================================================ */

/* ----------------------------------------------------------------
   WALLET DROPDOWN (header)
   ---------------------------------------------------------------- */

.wallet-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 340px;
    max-height: 420px;
    background: var(--bg-primary, #1a1a2e);
    border: 1px solid var(--border-color, #333);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 10001;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.wallet-dropdown.active {
    display: flex;
}

.wallet-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color, #333);
    text-align: center;
}

.wallet-balance-display {
    font-size: 1.6em;
    font-weight: 700;
    color: var(--text-primary, #e0e0e0);
    margin-bottom: 4px;
}

.wallet-balance-fiat {
    font-size: 0.85em;
    color: var(--text-secondary, #888);
}

.wallet-actions {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
}

.wallet-actions .btn {
    flex: 1;
}

.wallet-tx-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
    max-height: 240px;
}

.wallet-tx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-subtle, #2a2a3e);
    font-size: 0.85em;
}

.wallet-tx-item:last-child {
    border-bottom: none;
}

.wallet-tx-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    flex-shrink: 0;
}

.wallet-tx-icon.credit {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.wallet-tx-icon.debit {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.wallet-tx-detail {
    flex: 1;
    min-width: 0;
}

.wallet-tx-desc {
    color: var(--text-primary, #e0e0e0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wallet-tx-date {
    color: var(--text-secondary, #888);
    font-size: 0.8em;
}

.wallet-tx-amount {
    font-weight: 600;
    white-space: nowrap;
}

.wallet-tx-amount.credit {
    color: #22c55e;
}

.wallet-tx-amount.debit {
    color: #ef4444;
}

.wallet-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-secondary, #888);
    font-size: 0.9em;
}

/* ----------------------------------------------------------------
   CHECKOUT MODAL
   ---------------------------------------------------------------- */

.checkout-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.checkout-overlay.active {
    display: flex;
}

.checkout-modal {
    background: var(--bg-primary, #1a1a2e);
    border: 1px solid var(--border-color, #333);
    border-radius: 12px;
    padding: 0;
    max-width: 480px;
    width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    animation: checkoutSlideIn 0.2s ease-out;
}

@keyframes checkoutSlideIn {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.checkout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #333);
}

.checkout-header h3 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
}

.checkout-close {
    background: none;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 1.2em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.checkout-close:hover {
    background: var(--bg-hover, #2a2a3e);
    color: var(--text-primary, #e0e0e0);
}

.checkout-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Item card */
.checkout-item-card {
    background: var(--bg-secondary, #16162b);
    border: 1px solid var(--border-subtle, #2a2a3e);
    border-radius: 8px;
    padding: 14px 16px;
}

.checkout-item-name {
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    margin-bottom: 2px;
}

.checkout-item-subtitle {
    font-size: 0.85em;
    color: var(--text-secondary, #888);
    margin-bottom: 8px;
}

.checkout-item-price {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--accent-color, #3b6b7a);
}

/* Balance section */
.checkout-balance {
    background: var(--bg-secondary, #16162b);
    border: 1px solid var(--border-subtle, #2a2a3e);
    border-radius: 8px;
    padding: 14px 16px;
}

.checkout-balance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.checkout-balance-label {
    color: var(--text-secondary, #888);
    font-size: 0.9em;
}

.checkout-balance-value {
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
}

.checkout-balance-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkout-balance-toggle label {
    cursor: pointer;
    font-size: 0.9em;
    color: var(--text-primary, #e0e0e0);
}

.checkout-insufficient {
    font-size: 0.8em;
    color: #f59e0b;
    margin-top: 4px;
}

/* Divider */
.checkout-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary, #888);
    font-size: 0.85em;
}

.checkout-divider::before,
.checkout-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--border-subtle, #2a2a3e);
}

/* Currency selector */
.checkout-currency-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.checkout-currency-pill {
    padding: 6px 14px;
    border: 1px solid var(--border-color, #333);
    border-radius: 20px;
    background: transparent;
    color: var(--text-primary, #e0e0e0);
    cursor: pointer;
    font-size: 0.85em;
    transition: background 0.15s, border-color 0.15s;
}

.checkout-currency-pill:hover {
    background: var(--bg-hover, #2a2a3e);
}

.checkout-currency-pill.selected {
    background: var(--accent-color, #3b6b7a);
    border-color: var(--accent-color, #3b6b7a);
    color: #fff;
}

.checkout-currency-pill:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Conversion display */
.checkout-conversion {
    font-size: 0.9em;
    color: var(--text-primary, #e0e0e0);
}

.checkout-rate-info {
    font-size: 0.8em;
    color: var(--text-secondary, #888);
    margin-top: 2px;
}

/* Gateway selector */
.checkout-gateway-group {
    display: flex;
    gap: 12px;
}

.checkout-gateway-option {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color, #333);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
}

.checkout-gateway-option:hover {
    background: var(--bg-hover, #2a2a3e);
}

.checkout-gateway-option.selected {
    border-color: var(--accent-color, #3b6b7a);
    background: rgba(59, 107, 122, 0.1);
}

.checkout-gateway-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    font-size: 0.9em;
    margin-bottom: 2px;
}

.checkout-gateway-sub {
    font-size: 0.8em;
    color: var(--text-secondary, #888);
}

/* Top-up amount pills */
.checkout-topup-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.checkout-topup-pill {
    padding: 8px 16px;
    border: 1px solid var(--border-color, #333);
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary, #e0e0e0);
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
}

.checkout-topup-pill:hover {
    background: var(--bg-hover, #2a2a3e);
}

.checkout-topup-pill.selected {
    background: var(--accent-color, #3b6b7a);
    border-color: var(--accent-color, #3b6b7a);
    color: #fff;
}

.checkout-custom-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #333);
    border-radius: 6px;
    background: var(--bg-secondary, #16162b);
    color: var(--text-primary, #e0e0e0);
    font-size: 0.9em;
    margin-top: 8px;
    display: none;
}

.checkout-custom-input.visible {
    display: block;
}

/* Submit button */
.checkout-submit {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--accent-color, #3b6b7a);
    color: #fff;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.checkout-submit:hover {
    background: #2d5a68;
}

.checkout-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.checkout-submit.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Footer notes */
.checkout-footer {
    padding: 0 20px 16px;
    font-size: 0.75em;
    color: var(--text-secondary, #888);
    line-height: 1.4;
}

/* Wallet chip — joined to auth button */
.wallet-chip {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-right: none !important;
    padding-right: 8px !important;
    background: var(--accent-color, #3b6b7a) !important;
    color: #fff !important;
    border-color: var(--accent-color, #3b6b7a) !important;
}

.wallet-chip:hover {
    background: #2d5a68 !important;
    border-color: #2d5a68 !important;
}

/* Auth button rounds only right side when wallet is visible */
.wallet-chip + .titlebar-chip {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Balance badge — prominent display */
.wallet-balance-badge {
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Price display in marketplace cards */
.checkout-price-primary {
    font-weight: 700;
    color: var(--text-primary, #e0e0e0);
}

.checkout-price-secondary {
    font-size: 0.85em;
    color: var(--text-secondary, #888);
    margin-top: 2px;
}
