/* UPost compact Helcim checkout design - visual-only change. */
#payment .payment_box.payment_method_helcimjs {
    padding: 10px 12px !important;
    border-radius: 14px !important;
    background: #f8fafc !important;
}

#payment .payment_box.payment_method_helcimjs::before {
    border-bottom-color: #f8fafc !important;
}

#helcimResults:empty {
    display: none !important;
}

#payment label[for="payment_method_helcimjs"] small {
    display: block;
    margin-top: 2px;
    padding-left: 24px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.25;
    font-weight: 500;
}

#payment label[for="payment_method_helcimjs"] br {
    display: block;
    content: "";
}

.upost-helcim-payment-box {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 10px;
    width: 100%;
    margin: 0 !important;
    padding: 10px 12px 12px !important;
    border: 1px solid #dbe3ec !important;
    border-radius: 14px !important;
    background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%) !important;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06) !important;
    box-sizing: border-box;
}

.upost-helcim-payment-box * {
    box-sizing: border-box;
}

.upost-helcim-description,
.upost-helcim-secure-note,
.upost-helcim-payment-box .form-row-wide,
.upost-helcim-payment-box #tr_cardHolderName,
.upost-helcim-payment-box #tr_cardHolderAddress,
.upost-helcim-payment-box #tr_cardHolderPostalCode {
    grid-column: 1 / -1;
}

.upost-helcim-description {
    display: none !important;
    margin: 0 !important;
    padding: 9px 11px !important;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    color: #475569;
    font-size: 12.5px;
    line-height: 1.45;
}

.upost-helcim-payment-box .form-row {
    float: none !important;
    width: 100% !important;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
}

.upost-helcim-payment-box label {
    display: block;
    margin: 0 0 4px !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
    color: #334155 !important;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.upost-helcim-payment-box .required {
    color: #dc2626 !important;
}

.upost-helcim-payment-box input.input-text,
.upost-helcim-payment-box select.input-text,
.upost-helcim-payment-box .wc-credit-card-form-card-expiry,
.upost-helcim-payment-box .wc-credit-card-form-card-cvc {
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 14px !important;
    line-height: 38px !important;
    box-shadow: none !important;
    outline: none !important;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.upost-helcim-payment-box select.input-text,
.upost-helcim-payment-box .wc-credit-card-form-card-expiry {
    padding-right: 32px !important;
}

.upost-helcim-payment-box input.input-text:focus,
.upost-helcim-payment-box select.input-text:focus,
.upost-helcim-payment-box .wc-credit-card-form-card-expiry:focus,
.upost-helcim-payment-box .wc-credit-card-form-card-cvc:focus {
    border-color: #127295 !important;
    box-shadow: 0 0 0 3px rgba(18, 114, 149, 0.14) !important;
    background: #ffffff !important;
}

.upost-helcim-payment-box #cardNumber {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    letter-spacing: 0.06em;
}

.upost-helcim-payment-box #cardCVV {
    max-width: none !important;
}

.upost-helcim-secure-note {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin-top: 1px;
    padding-top: 2px;
    color: #64748b;
    font-size: 11.5px;
    line-height: 1.35;
}

.upost-helcim-secure-note strong {
    color: #334155;
}

/* WooCommerce Blocks fallback */
.wc-block-components-payment-method-accordion .wc-block-components-text-input #cardNumber,
.wc-block-components-payment-method-accordion .wc-block-components-text-input #cardCVV,
.wc-block-components-payment-method-accordion select#cardExpiryMonth,
.wc-block-components-payment-method-accordion select#cardExpiryYear {
    border-radius: 10px !important;
    border-color: #cbd5e1 !important;
}

@media (max-width: 640px) {
    #payment .payment_box.payment_method_helcimjs {
        padding: 12px !important;
    }

    .upost-helcim-payment-box {
        grid-template-columns: 1fr !important;
        padding: 13px !important;
        border-radius: 16px !important;
    }

    .upost-helcim-card-icon {
        width: 35px;
        height: 35px;
        flex-basis: 35px;
    }
}

.upost-helcim-secure-note > span:first-child {
    color: #16a34a;
    font-size: 14px;
    line-height: 1;
}

.upost-helcim-bin-status {
    display: block;
    min-height: 15px;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.3;
    font-weight: 600;
    color: #64748b;
}

.upost-helcim-bin-status:empty {
    display: none;
}

.upost-helcim-bin-status.is-checking,
.upost-helcim-bin-status.is-neutral {
    color: #64748b;
}

.upost-helcim-bin-status.is-no-fee {
    color: #15803d;
}

.upost-helcim-bin-status.is-fee {
    color: #b45309;
}

/* v4.0.17-upost: card type status is now shown beside the Card Number label. */
.upost-helcim-card-number-label {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
}

.upost-helcim-card-number-label .upost-helcim-bin-status {
    margin: 0 !important;
    min-height: 0 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
    text-align: right;
}

.upost-helcim-card-number-row {
    grid-column: 1 / -1;
}

.upost-helcim-bin-row {
    display: none !important;
}

/* v4.0.17-upost: show card fee cleanly on Pay for order by reusing the Payment method row. */
form#order_review tr.upost-helcim-card-fee th,
form[name="order_review"] tr.upost-helcim-card-fee th,
tr.upost-helcim-card-fee th {
    color: #334155 !important;
    font-weight: 700 !important;
}

form#order_review tr.upost-helcim-card-fee td,
form[name="order_review"] tr.upost-helcim-card-fee td,
tr.upost-helcim-card-fee td {
    color: #0f172a !important;
    font-weight: 700 !important;
}

/* v4.0.18-upost: keep expiry month/year visibly selected after WooCommerce refresh/theme styling. */
.upost-helcim-payment-box select#cardExpiryMonth,
.upost-helcim-payment-box select#cardExpiryYear,
.upost-helcim-payment-box select#upostCardExpiryMonthUI,
.upost-helcim-payment-box select#upostCardExpiryYearUI,
#cardExpiryMonth,
#cardExpiryYear,
#upostCardExpiryMonthUI,
#upostCardExpiryYearUI {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    opacity: 1 !important;
    appearance: auto !important;
    -webkit-appearance: menulist !important;
}

.upost-helcim-payment-box select#cardExpiryMonth option,
.upost-helcim-payment-box select#cardExpiryYear option,
.upost-helcim-payment-box select#upostCardExpiryMonthUI option,
.upost-helcim-payment-box select#upostCardExpiryYearUI option,
#cardExpiryMonth option,
#cardExpiryYear option,
#upostCardExpiryMonthUI option,
#upostCardExpiryYearUI option {
    color: #0f172a !important;
    background: #ffffff !important;
}

/* UPost 4.0.26: separate month/year inputs. Do not use WooCommerce expiry mask class. */
.upost-helcim-payment-box .upost-helcim-expiry-input,
#cardExpiryMonth.upost-helcim-expiry-input,
#cardExpiryYear.upost-helcim-expiry-input {
    width: 100% !important;
    min-height: 40px;
    box-sizing: border-box;
    letter-spacing: 0.04em;
}

.upost-helcim-payment-box #cardExpiryYear.upost-helcim-expiry-year {
    min-width: 92px;
}

/* UPost 4.0.29: keep card type detection internal. Do not show debit/credit checking text on checkout. */
#upost-helcim-bin-status,
.upost-helcim-bin-status {
    display: none !important;
    visibility: hidden !important;
}

/* UPost 4.0.30: hide redundant Payment method summary row on Pay for order checkout. */
form#order_review table.shop_table tr.payment-method,
form#order_review table.shop_table tr.woocommerce-table__payment-method,
form[name="order_review"] table.shop_table tr.payment-method,
form[name="order_review"] table.shop_table tr.woocommerce-table__payment-method {
    display: none !important;
}


/* UPost 4.0.35: AVS helper fields restored for Pay for order / missing billing fields. */
.upost-helcim-avs-note {
    grid-column: 1 / -1;
    margin: -2px 0 2px !important;
    padding: 8px 10px !important;
    border: 1px dashed #cbd5e1 !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    color: #64748b !important;
    font-size: 11.5px !important;
    line-height: 1.35 !important;
}

/* UPost 4.0.37 HelcimPay.js modal mode */
.upost-helcimpayjs-box {
    padding: 16px;
}
.upost-helcim-payjs-intro {
    margin: 0 0 12px 0;
    line-height: 1.45;
}
