/**
 * Checkout WC bridge — hide scrape junk, keep WFACP layout intact.
 */

/* Thank you page (order-received endpoint on custom checkout template) */
body.vm-order-received-body .vm-order-received-wrap {
    max-width: 720px;
    margin: 3rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

body.vm-order-received-body .woocommerce-thankyou-order-received {
    font-size: 1.35rem;
    font-weight: 600;
    color: #4a5238;
    margin-bottom: 1.5rem;
}

body.vm-order-received-body .woocommerce-order-overview {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}

body.vm-order-received-body .woocommerce-order-overview li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #ece8df;
}

/* No cart drawer / add-to-cart banner on checkout */
body.vm-checkout-test-body .woocommerce-message,
body.vm-checkout-test-body .woocommerce-info {
    display: none !important;
}

/* Hide global error banner — inline errors under each field */
body.vm-checkout-test-body .woocommerce-error,
body.vm-checkout-test-body .woocommerce-notices-wrapper .woocommerce-error {
    display: none !important;
}

body.vm-checkout-test-body #wfacp-e-form .wfacp_inline_error {
    display: block;
    color: #c0392b;
    font-size: 13px;
    line-height: 1.35;
    margin-top: 6px;
}

body.vm-checkout-test-body #wfacp-e-form .wfacp_inline_error:empty,
body.vm-checkout-test-body #vm_payment_inline_error:empty {
    display: none !important;
}

body.vm-checkout-test-body #vm_payment_inline_error {
    color: #c0392b;
    font-size: 13px;
    line-height: 1.35;
    margin: 8px 0 0;
    padding: 0 4px;
}

body.vm-checkout-test-body #wfacp-e-form .woocommerce-invalid .wfacp-form-control,
body.vm-checkout-test-body #wfacp-e-form .woocommerce-invalid input.input-text,
body.vm-checkout-test-body #wfacp-e-form .woocommerce-invalid select.wfacp-form-control,
body.vm-checkout-test-body #wfacp-e-form .vm-field-invalid {
    border-color: #c0392b !important;
    box-shadow: 0 0 0 1px rgba(192, 57, 43, 0.15) !important;
}

body.vm-checkout-test-body #payment.vm-payment-invalid .payment_method_stripe .payment_box,
body.vm-checkout-test-body #payment.vm-payment-invalid .payment_method_stripe {
    outline: 2px solid #c0392b;
    outline-offset: 2px;
    border-radius: 8px;
}

body.vm-checkout-test-body #fkcart-modal,
body.vm-checkout-test-body #fkcart-floating-toggler {
    display: none !important;
}

/* BG shipping widget leftovers from prod scrape — not used on staging */
#wc-speedy-city-select-container,
#wc-speedy-street-quarter-select-container,
#wc-speedy-address-detail-container,
#wc-speedy-office-select-container,
#wc-econt-city-select-container,
#wc-econt-street-quarter-select-container,
#wc-econt-address-detail-container,
#wc-econt-office-select-container,
#wc-boxnow-office-select-container,
#wc-fan-office-select-container,
#wc-sameday-office-select-container,
#wc-packeta-office-select-container,
#wc-ro-region-select-container,
#wc-ro-city-select-container,
#wc-ro-postcode-container,
#wc-ro-address-detail-container {
    display: none !important;
}

/* Form inputs — neutral borders (override scrape / validation red) */
body.vm-checkout-test-body #wfacp-e-form .wfacp-form-control,
body.vm-checkout-test-body #wfacp-e-form input.input-text,
body.vm-checkout-test-body #wfacp-e-form textarea.wfacp-form-control {
    border: 1px solid #d4cfc2 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}

body.vm-checkout-test-body #wfacp-e-form .woocommerce-invalid .wfacp-form-control {
    border-color: #c0392b !important;
}

/* Stripe injects easel overlays on <body> — block click theft outside payment box */
body.vm-checkout-test-body iframe {
    pointer-events: none !important;
}

body.vm-checkout-test-body #payment .payment_box iframe {
    pointer-events: auto !important;
}

body.vm-checkout-test-body #wfacp-e-form #payment .payment_box {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

/* Order bumps from scrape — FunnelKit WFOB plugin not active */
body.vm-checkout-test-body #wfob_wrap,
body.vm-checkout-test-body .wfob_wrap_start,
body.vm-checkout-test-body input[name^="wfob_"],
body.vm-checkout-test-body input[id^="wfob_"] {
    display: none !important;
}

/* Clear selected state for shipping / payment */
body.vm-checkout-test-body .wfacp_single_shipping_method.vm-shipping-selected,
body.vm-checkout-test-body #payment .wc_payment_method.vm-payment-selected {
    outline: 2px solid #7a8450;
    outline-offset: 2px;
    border-radius: 8px;
}

body.vm-checkout-test-body .wfacp_single_shipping_method,
body.vm-checkout-test-body #payment .wc_payment_method {
    cursor: pointer;
    padding: 8px;
    margin-bottom: 6px;
    border-radius: 8px;
}

body.vm-checkout-test-body .wfacp_shipping_radio label,
body.vm-checkout-test-body #payment .wc_payment_method > label {
    cursor: pointer;
}
#wfacp-e-form #payment .wc_payment_methods {
    list-style: none;
    margin: 0;
    padding: 0;
}

#wfacp-e-form #payment .payment_box {
    margin-top: 8px;
}

/* Only show payment fields for the selected gateway */
body.vm-checkout-test-body #payment .wc_payment_method .payment_box {
    display: none !important;
}

body.vm-checkout-test-body #payment .wc_payment_method > input.input-radio:checked ~ .payment_box {
    display: block !important;
}

#wfacp-e-form #payment .wc-upe-form,
#wfacp-e-form #payment .ppcp-button-container {
    max-width: 100%;
}

/* CIF empresa — solo visible si se marca la casilla */
body.vm-checkout-test-body #billing_nif_field {
    display: none !important;
}

body.vm-checkout-test-body #invoice_asking_field:has(#invoice_asking:checked) + #billing_nif_field {
    display: block !important;
}

/* Shipping address / pickup — toggled by checkout-interactivity.js */
body.vm-checkout-test-body #vm_checkout_address_wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
    width: 100%;
    clear: both;
}

body.vm-checkout-test-body #vm_checkout_address_wrap .vm-address-field {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    float: none !important;
    width: 100% !important;
}

body.vm-checkout-test-body #vm_checkout_address_wrap label.wfacp-form-control-label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

body.vm-checkout-test-body #vm_checkout_address_wrap .woocommerce-input-wrapper {
    display: block;
    width: 100%;
}

body.vm-checkout-test-body #vm_checkout_address_wrap .input-text,
body.vm-checkout-test-body #vm_checkout_address_wrap select.wfacp-form-control {
    width: 100%;
    box-sizing: border-box;
    min-height: 48px;
    padding: 12px 14px !important;
    border: 1px solid #d4cfc2 !important;
    border-radius: 8px !important;
    background: #fff;
    font-size: 15px;
    line-height: 1.4;
    margin: 0;
}

body.vm-checkout-test-body #vm_checkout_address_wrap select.wfacp-form-control {
    appearance: auto;
    cursor: pointer;
}

body.vm-checkout-test-body #vm_checkout_address_wrap .wfacp_inline_error:empty {
    display: none !important;
}

body.vm-checkout-test-body #vm_checkout_address_wrap .wfacp_inline_error:not(:empty) {
    display: block !important;
}

/* GLS ParcelShop + Packlink drop-off widgets */
body.vm-checkout-test-body #parcelinfo-container,
body.vm-checkout-test-body #packlink-drop-off-picker,
body.vm-checkout-test-body .vm_carrier_shipping_hooks {
    margin-top: 12px;
}

body.vm-checkout-test-body #parcelinfo-container input.button {
    margin-top: 8px;
}
