/* Wallet top-up modal — centered dialog (Kawenter brand, no decorative shadows) */

.wallet-topup-modal {
    --wtm-primary: var(--primary-color, #4361ee);
    --wtm-primary-dark: var(--primary-dark, #1c4494);
    --wtm-border: #e8eaed;
    --wtm-muted: #94a3b8;
    --wtm-text: #0f172a;
    position: fixed;
    inset: 0;
    z-index: 100070;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.wallet-topup-modal[hidden] {
    display: none !important;
}

.wallet-topup-modal__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(15, 23, 42, 0.45);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.wallet-topup-modal.is-open .wallet-topup-modal__backdrop {
    opacity: 1;
}

.wallet-topup-modal.is-closing .wallet-topup-modal__backdrop {
    opacity: 0;
}

.wallet-topup-modal__panel {
    position: relative;
    z-index: 1;
    width: min(100%, 420px);
    max-height: min(92vh, 720px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--wtm-border);
    border-radius: 22px;
    box-shadow: none;
    overflow: hidden;
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    transition:
        transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
        opacity 0.22s ease;
}

.wallet-topup-modal.is-open .wallet-topup-modal__panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.wallet-topup-modal.is-closing .wallet-topup-modal__panel {
    transform: translateY(12px) scale(0.98);
    opacity: 0;
}

.wallet-topup-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.1rem 1.15rem 0.85rem;
}

.wallet-topup-modal__close {
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
    box-shadow: none;
}

.wallet-topup-modal__close:hover {
    background: #e2e8f0;
    color: #334155;
}

.wallet-topup-modal__titles {
    min-width: 0;
    text-align: start;
}

.wallet-topup-modal__titles h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--wtm-text);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.wallet-topup-modal__step {
    margin: 0.25rem 0 0;
    font-size: 0.82rem;
    color: var(--wtm-muted);
    font-weight: 500;
}

.wallet-topup-modal__progress {
    display: flex;
    gap: 0.35rem;
    padding: 0 1.15rem 0.9rem;
}

.wallet-topup-modal__progress span {
    flex: 1;
    height: 4px;
    border-radius: 99px;
    background: #e2e8f0;
}

.wallet-topup-modal__progress span.is-active {
    background: var(--wtm-primary);
}

.wallet-topup-modal__body {
    padding: 0 1.15rem 1rem;
    overflow: auto;
    flex: 1 1 auto;
}

.wallet-topup-modal__balance {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.1rem;
    border-radius: 16px;
    background: linear-gradient(145deg, var(--wtm-primary) 0%, var(--wtm-primary-dark) 100%);
    color: #fff;
    border: 1px solid transparent;
    box-shadow: none;
    margin-bottom: 1.15rem;
}

.wallet-topup-modal__balance-label {
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 0.92;
}

.wallet-topup-modal__balance-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}

.wallet-topup-modal__field {
    margin-bottom: 1.1rem;
}

.wallet-topup-modal__label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
}

.wallet-topup-modal__input-wrap {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.15rem 0.85rem;
    min-height: 3.25rem;
    border: 1.5px solid #c7d2fe;
    border-radius: 14px;
    background: #fff;
    box-shadow: none;
}

/* Photo layout: currency badge on the inline-start side of the value */
.wallet-topup-modal__input-wrap {
    flex-direction: row;
}

html[dir="rtl"] .wallet-topup-modal__input-wrap {
    flex-direction: row;
}

.wallet-topup-modal__input-wrap:focus-within {
    border-color: var(--wtm-primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.18);
}

.wallet-topup-modal__currency {
    flex: 0 0 auto;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.wallet-topup-modal__input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--wtm-text);
    font-variant-numeric: tabular-nums;
    outline: none;
    width: 100%;
    padding: 0.55rem 0;
}

.wallet-topup-modal__input::placeholder {
    color: #cbd5e1;
    font-weight: 600;
}

.wallet-topup-modal__quick {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}

.wallet-topup-modal__chip {
    appearance: none;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: var(--wtm-text);
    border-radius: 12px;
    min-height: 2.75rem;
    padding: 0.45rem 0.35rem;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: none;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.wallet-topup-modal__chip:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.wallet-topup-modal__chip.is-selected {
    border-color: var(--wtm-primary);
    background: #eef2ff;
    color: var(--wtm-primary-dark);
}

.wallet-topup-modal__summary {
    margin-top: 0.25rem;
    padding: 1rem;
    border: 1px solid var(--wtm-border);
    border-radius: 14px;
    background: #f8fafc;
    box-shadow: none;
}

.wallet-topup-modal__summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.wallet-topup-modal__summary-row + .wallet-topup-modal__summary-row {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid #e2e8f0;
}

.wallet-topup-modal__summary-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
}

.wallet-topup-modal__summary-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--wtm-text);
    font-variant-numeric: tabular-nums;
}

.wallet-topup-modal__error {
    margin: 0.75rem 0 0;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.85rem;
    box-shadow: none;
}

.wallet-topup-modal__error[hidden],
.wallet-topup-modal__auth[hidden],
#walletTopupModalStep1[hidden],
#walletTopupModalStep2[hidden] {
    display: none !important;
}

.wallet-topup-modal__foot {
    display: flex;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.85rem 1.15rem 1.15rem;
    border-top: 1px solid #f1f5f9;
}

.wallet-topup-modal__foot[hidden] {
    display: none !important;
}

/* Keep Cancel on the visual left / Continue on the visual right (matches reference). */
html[dir="rtl"] .wallet-topup-modal__foot {
    flex-direction: row-reverse;
}

.wallet-topup-modal__cancel {
    flex: 0 0 auto;
    min-width: 5.5rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1.5px solid var(--wtm-primary);
    background: #fff;
    color: var(--wtm-primary);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: none;
}

.wallet-topup-modal__cancel:hover {
    background: #eef2ff;
}

.wallet-topup-modal__continue,
.wallet-topup-modal__pay {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 3.1rem;
    padding: 0.85rem 1rem;
    border: 0;
    border-radius: 14px;
    background: var(--wtm-primary);
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 750;
    cursor: pointer;
    box-shadow: none;
}

html[dir="rtl"] .wallet-topup-modal__continue .fa-chevron-right {
    transform: scaleX(-1);
}

.wallet-topup-modal__continue:hover:not(:disabled),
.wallet-topup-modal__pay:hover:not(:disabled) {
    background: var(--wtm-primary-dark);
}

.wallet-topup-modal__continue:disabled,
.wallet-topup-modal__pay:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wallet-topup-modal__pay.is-loading {
    pointer-events: none;
    opacity: 0.75;
}

.wallet-topup-modal__auth {
    text-align: center;
    padding: 1.25rem 0.5rem 0.5rem;
}

.wallet-topup-modal__auth p {
    margin: 0 0 1rem;
    color: #64748b;
    font-size: 0.92rem;
}

.wallet-topup-modal__auth .btn-primary {
    display: inline-flex;
}

body.wallet-topup-modal-open {
    overflow: hidden;
}

@media (max-width: 480px) {
    .wallet-topup-modal {
        padding: 0.65rem;
        align-items: flex-end;
    }

    .wallet-topup-modal__panel {
        width: 100%;
        border-radius: 22px 22px 16px 16px;
        max-height: min(94vh, 760px);
    }

    .wallet-topup-modal__quick {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .wallet-topup-modal__backdrop,
    .wallet-topup-modal__panel {
        transition: none;
    }
}
