/*
 * WalletPay Gateway — frontend styles.
 *
 * Scope: classic checkout wallet picker, WC Blocks wallet picker, and the
 * thank-you page receipt uploader. All rules are namespaced with
 * `.walletpay-` / `.walletpay-blocks-` so they never collide with WC or
 * FunnelKit defaults.
 */

/* ---------- Wallet picker (classic checkout + thank-you) ------------- */

.walletpay-wallets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin: 10px 0 14px;
}

.walletpay-wallet {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #d5d7dd;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}

.walletpay-wallet:hover {
    border-color: #9ea3ad;
}

.walletpay-wallet.is-checked,
.walletpay-wallet:has(.walletpay-wallet__input:checked) {
    border-color: var(--wp-color, #2271b1);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--wp-color, #2271b1) 30%, transparent);
}

.walletpay-wallet__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.walletpay-wallet__bullet {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--wp-color, #2271b1);
    flex: 0 0 auto;
}

.walletpay-wallet__label {
    font-weight: 600;
    line-height: 1.2;
}

.walletpay-no-wallets,
.walletpay-blocks-empty {
    padding: 10px 12px;
    background: #fff4e5;
    border: 1px solid #e0b37a;
    border-radius: 6px;
    color: #5a3a00;
    margin: 8px 0;
}

/* ---------- Details panel (revealed after selection) ---------------- */

.walletpay-selected[hidden] { display: none; }

.walletpay-details {
    background: #f6f7f9;
    border: 1px solid #e2e4ea;
    border-radius: 10px;
    padding: 14px 16px;
    margin-top: 8px;
}

.walletpay-details[hidden] { display: none; }

.walletpay-details__instructions {
    margin: 0 0 10px;
}

.walletpay-details__list,
.walletpay-thankyou__details {
    list-style: none;
    padding: 0;
    margin: 0 0 10px;
    display: grid;
    gap: 4px;
}

.walletpay-details__list li,
.walletpay-thankyou__details li { line-height: 1.5; }

/* Copy-to-clipboard rows on the checkout-side selector. */
.walletpay-details__copyrow,
.walletpay-thankyou__copyrow {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.walletpay-details__copyvalue {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: #fff;
    border: 1px solid #e2e4ea;
    padding: 2px 8px;
    border-radius: 4px;
    user-select: all;
}

.walletpay-details__qr,
.walletpay-thankyou__qr {
    margin: 10px 0 0;
    text-align: center;
}

.walletpay-details__qr img,
.walletpay-thankyou__qr img,
.walletpay-blocks-qr img,
body .walletpay-details__qr img,
body .walletpay-thankyou__qr img,
body .walletpay-blocks-qr img,
#payment .walletpay-details__qr img,
#payment .walletpay-thankyou__qr img,
.woocommerce-checkout .walletpay-details__qr img,
.woocommerce-checkout .walletpay-thankyou__qr img,
.wfacp_main_form .walletpay-details__qr img,
.wfacp_main_form .walletpay-thankyou__qr img,
#wfacp-e-form .walletpay-details__qr img,
#wfacp-e-form .walletpay-thankyou__qr img,
#wfacp-e-form ul.payment_methods li .walletpay-details__qr img,
#wfacp-e-form ul.payment_methods li .walletpay-thankyou__qr img {
    /*
     * QR image rendering is fragile because FunnelKit, Divi WooCommerce
     * modules, and several themes set fixed heights on `img` elements
     * inside payment method panels (intended for tiny gateway icons like
     * Visa/Mastercard). Without this hardening, a real QR gets clamped to
     * ~24px tall and stretched horizontally into a colored bar.
     *
     * Every property below is !important to win the cascade against
     * those rules regardless of which selector specificity they use.
     */
    max-width: 240px !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    padding: 6px !important;
    display: block !important;
    object-fit: contain !important;
    vertical-align: baseline !important;
    border: 1px solid #e2e4ea !important;
    border-radius: 8px !important;
    background: #fff !important;
    box-sizing: content-box !important;
}

.walletpay-details__qr figcaption,
.walletpay-thankyou__qr figcaption {
    font-size: .85em;
    color: #555;
    margin-top: 4px;
}

.walletpay-note {
    margin-top: 8px;
    color: #555;
    font-size: .9em;
}

/* Post-selector reassurance line on checkout. Slightly more prominent than
 * `.walletpay-note` because it's the only thing between the radio selector
 * and the "Pay & enroll" button — customers need to see and trust it. */
.walletpay-checkout-note {
    margin: 12px 0 4px;
    padding: 10px 12px;
    color: #2a4163;
    background: #f3f6fb;
    border-left: 3px solid #4f74c4;
    border-radius: 4px;
    font-size: 0.92em;
    line-height: 1.4;
}

/* ---------- Thank-you page ------------------------------------------ */

.walletpay-thankyou {
    margin: 20px 0 30px;
    padding: 20px;
    border: 1px solid #e2e4ea;
    border-radius: 12px;
    background: #fff;
}

.walletpay-thankyou.is-received {
    border-color: #b9e6c4;
    background: #f3fbf5;
}

.walletpay-thankyou__title {
    margin: 0 0 12px;
    font-size: 1.4em;
}

.walletpay-thankyou.is-received .walletpay-thankyou__title {
    color: #1a7f37;
}

/* Collapsible wallet details panel — uses native <details>/<summary>. */
.walletpay-thankyou__wallet {
    margin: 0 0 16px;
    border: 1px solid #e2e4ea;
    border-radius: 8px;
    background: #f7f8fa;
}

.walletpay-thankyou__wallet-summary {
    cursor: pointer;
    padding: 12px 14px;
    list-style: none;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-weight: 600;
}

.walletpay-thankyou__wallet-summary::-webkit-details-marker { display: none; }

.walletpay-thankyou__wallet-summary::after {
    content: "▾";
    font-size: 0.8em;
    color: #6b7280;
    transition: transform 0.15s ease;
}

.walletpay-thankyou__wallet[open] .walletpay-thankyou__wallet-summary::after {
    transform: rotate(180deg);
}

.walletpay-thankyou__wallet-body {
    padding: 0 14px 14px;
}

.walletpay-thankyou__wallet-name {
    padding-left: 12px;
    border-left: 4px solid var(--wp-color, #2271b1);
    font-size: 1em;
}

.walletpay-thankyou__instructions { margin: 8px 0; }

/* Copy-to-clipboard rows for phone, account, CCI. */
.walletpay-thankyou__copyrow {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.walletpay-thankyou__copyvalue {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: #fff;
    border: 1px solid #e2e4ea;
    padding: 2px 8px;
    border-radius: 4px;
    user-select: all;
}

/* Theme overrides commonly hit Divi/Elementor/FunnelKit; the !important
 * declarations below apply only to color/background/border properties that
 * themes are most likely to override globally on `button`. Layout and font
 * properties stay normal so themes can still tweak sizing. */
button.walletpay-copy-btn,
.walletpay-copy-btn {
    border: 1px solid #c7cad1 !important;
    background: #fff !important;
    background-color: #fff !important;
    background-image: none !important;
    color: #2271b1 !important;
    font-size: 0.85em;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    line-height: 1.4;
    min-height: 28px;
    text-decoration: none;
    box-shadow: none !important;
    text-shadow: none !important;
}

button.walletpay-copy-btn:hover,
.walletpay-copy-btn:hover {
    background: #f0f6fc !important;
    background-color: #f0f6fc !important;
    color: #135e96 !important;
    border-color: #135e96 !important;
}

button.walletpay-copy-btn.is-copied,
.walletpay-copy-btn.is-copied {
    background: #e6f4ea !important;
    background-color: #e6f4ea !important;
    color: #1a7f37 !important;
    border-color: #b9e6c4 !important;
}

.walletpay-thankyou__expired,
.walletpay-thankyou__received {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: 8px;
}

.walletpay-thankyou__received--success {
    background: #e8f5ec;
    border: 1px solid #b9e6c4;
    color: #1a7f37;
}

/* ---------- Upload form --------------------------------------------- */

.walletpay-upload {
    margin-top: 14px;
    padding: 16px;
    border: 1px dashed #b8bcc6;
    border-radius: 10px;
    background: #fafbfd;
}

/* Numbered "How to pay" step list */
.walletpay-upload__steps {
    margin: 0 0 16px;
    padding: 0 0 0 24px;
    list-style: decimal;
    color: #1f2937;
    font-size: 1em;
    line-height: 1.55;
}

.walletpay-upload__steps li {
    margin-bottom: 8px;
}

.walletpay-upload__steps strong {
    background: #fff;
    border: 1px solid #e2e4ea;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.walletpay-upload__order-hint {
    display: block;
    font-size: 0.88em;
    color: #6b7280;
    margin-top: 2px;
}

.walletpay-upload__label {
    font-weight: 600;
    font-size: 1.05em;
    margin: 0 0 12px;
}

/* Hide the native file inputs — the <label>s become the visible CTAs. */
.walletpay-upload__file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.walletpay-upload__inputs {
    display: flex;
    gap: 10px;
    margin: 8px 0 12px;
    flex-direction: column;
}

.walletpay-upload__cta {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 18px !important;
    border-radius: 8px !important;
    font-weight: 600;
    font-size: 1.05em;
    cursor: pointer;
    text-align: center;
    line-height: 1.3;
    transition: transform 0.05s ease, box-shadow 0.15s ease, background 0.15s ease;
    min-height: 52px;
    box-sizing: border-box;
    width: 100%;
}

.walletpay-upload__cta:active {
    transform: translateY(1px);
}

.walletpay-upload__cta--primary,
.walletpay-upload__cta--camera {
    background: #2271b1 !important;
    color: #fff !important;
    border: 1px solid #2271b1 !important;
}

.walletpay-upload__cta--primary:hover,
.walletpay-upload__cta--camera:hover {
    background: #1d63a0 !important;
}

.walletpay-upload__cta--gallery {
    background: #fff !important;
    color: #2271b1 !important;
    border: 1px solid #c7cad1 !important;
}

.walletpay-upload__cta--gallery:hover {
    background: #f0f6fc !important;
}

.walletpay-upload__cta-icon {
    font-size: 1.2em;
    line-height: 1;
}

.walletpay-upload__filename {
    margin: 8px 0;
    color: #6b7280;
    font-size: 0.92em;
    font-style: italic;
}

.walletpay-upload__filename.is-set {
    color: #1f2937;
    font-style: normal;
    background: #eef2f6;
    padding: 6px 10px;
    border-radius: 4px;
}

.walletpay-upload__submit {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 180px;
    min-height: 44px;
    margin-top: 4px;
    position: relative;
}

.walletpay-upload__submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.walletpay-upload__submit-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: walletpay-spin 0.7s linear infinite;
}

.walletpay-upload__submit.is-loading .walletpay-upload__submit-spinner {
    display: inline-block;
}

@keyframes walletpay-spin {
    to { transform: rotate(360deg); }
}

.walletpay-upload__help {
    font-size: .85em;
    color: #6b7280;
    margin: 10px 0 0;
}

.walletpay-upload__status {
    margin-top: 10px;
    min-height: 1.4em;
    font-size: .95em;
    padding: 0;
    transition: padding 0.2s ease, background 0.2s ease;
}

.walletpay-upload__status.is-success {
    color: #1a7f37;
    background: #e8f5ec;
    border: 1px solid #b9e6c4;
    padding: 10px 12px;
    border-radius: 6px;
}
.walletpay-upload__status.is-error {
    color: #b32d2e;
    background: #fcece9;
    border: 1px solid #f5c2bf;
    padding: 10px 12px;
    border-radius: 6px;
}
.walletpay-upload__status.is-info { color: #2271b1; }

/* Mobile: larger tap targets across the form. */
@media (max-width: 480px) {
    .walletpay-upload__cta {
        min-height: 56px;
        font-size: 1.1em;
    }
    .walletpay-upload__submit {
        width: 100%;
        min-height: 52px;
    }
    .walletpay-thankyou__copyrow,
    .walletpay-details__copyrow {
        font-size: 1em;
    }
    .walletpay-copy-btn {
        min-height: 36px;
        font-size: 0.95em;
    }
}

/* ---------- WC Blocks checkout -------------------------------------- */

.walletpay-blocks { display: block; }

.walletpay-blocks-desc {
    margin: 0 0 10px;
    color: #555;
}

.walletpay-blocks-wallets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    margin: 8px 0;
}

.walletpay-blocks-wallet {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #d5d7dd;
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
}

.walletpay-blocks-wallet.is-checked {
    border-color: var(--wp-color, #2271b1);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--wp-color, #2271b1) 30%, transparent);
}

.walletpay-blocks-wallet__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.walletpay-blocks-wallet__bullet {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--wp-color, #2271b1);
}

.walletpay-blocks-wallet__label {
    font-weight: 600;
}

.walletpay-blocks-details {
    margin-top: 10px;
    padding: 12px 14px;
    background: #f6f7f9;
    border: 1px solid #e2e4ea;
    border-radius: 8px;
}

.walletpay-blocks-list {
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
    display: grid;
    gap: 4px;
}

.walletpay-blocks-qr {
    margin: 10px 0 0;
    text-align: center;
}

.walletpay-blocks-qr img {
    max-width: 220px;
    width: 100%;
    height: auto;
    border: 1px solid #e2e4ea;
    border-radius: 8px;
    background: #fff;
    padding: 6px;
}

.walletpay-blocks-note {
    margin-top: 10px;
    color: #555;
    font-size: .9em;
}

/* ---------- Small screens ------------------------------------------- */

@media (max-width: 480px) {
    .walletpay-wallets,
    .walletpay-blocks-wallets {
        grid-template-columns: 1fr;
    }
}

/* ---------- v1.3.1: wallet icons + order number copy ---------------- */

/* Wallet icon next to the radio label on checkout */
.walletpay-wallet__icon {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    object-fit: contain !important;
    margin: 0 6px 0 0;
    vertical-align: middle;
    display: inline-block !important;
    background: transparent;
    border: 0 !important;
    padding: 0 !important;
}

/* Wallet icon next to the wallet name on the thank-you page */
.walletpay-thankyou__wallet-icon {
    width: 22px !important;
    height: 22px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    object-fit: contain !important;
    margin: 0 8px 0 0;
    vertical-align: middle;
    display: inline-block !important;
    background: transparent;
    border: 0 !important;
    padding: 0 !important;
}

/* Order number presented as a copyable code element */
.walletpay-upload__order-no {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: #fff;
    border: 1px solid #e2e4ea;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    color: #1f2937;
    user-select: all;
}

/* Inline-variant of the Copy button for use within prose */
.walletpay-copy-btn--inline {
    margin-left: 4px;
    padding: 2px 8px !important;
    font-size: 0.82em;
    min-height: 24px;
    line-height: 1.3;
}
