/* eCheck Input Fields - Theme-friendly styling */
.text-input-echeck {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: normal;
    padding: 0.6180469716em;
    display: block;
    width: 100% !important;
    background-color: var(--wc-form-color-background, #fff);
    border: var(--wc-form-border-width, 1px) solid var(--wc-form-border-color, #ddd);
    border-radius: var(--wc-form-border-radius, 4px);
    color: var(--wc-form-color-text, #000);
    box-sizing: border-box;
    margin: 0;
    line-height: normal;
}

/* Ensure select dropdowns match input styling */
.anet-payment-form select.text-input-echeck,
.anet-payment-form .woocommerce-input-wrapper select.text-input-echeck,
.anet-payment-form .form-row select.text-input-echeck,
.anet-payment-form select#anet-echeck-bank-account-type {
    width: 100% !important;
    font-size: 1rem;
    padding: 0.6180469716em;
    max-width: 100%;
    box-sizing: border-box;
    line-height: normal;
}

/* Additional selector coverage for select elements */
.woocommerce-billing-fields__field-wrapper_echeck.anet-payment-form .form-row-pair .form-row select,
.woocommerce-billing-fields__field-wrapper_echeck.anet-payment-form .woocommerce-input-wrapper select {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
}

/* Focus styles - match WooCommerce default fields */
.anet-payment-form input[type="tel"].text-input-echeck:focus,
.anet-payment-form input[type="text"].text-input-echeck:focus,
.anet-payment-form select.text-input-echeck:focus {
    border-color: #000;
    outline: 2px solid #000;
    outline-offset: 0;
}

.anet-payment-form input[type="tel"].text-input-echeck:focus-visible,
.anet-payment-form input[type="text"].text-input-echeck:focus-visible,
.anet-payment-form select.text-input-echeck:focus-visible {
    border-color: #000;
    outline: 2px solid #000;
    outline-offset: 0;
}

/* Validation states */
.woocommerce form .form-row.woocommerce-validated input.text-input-echeck {
    border-color: #69bf29;
}

.woocommerce form .form-row.woocommerce-invalid input.text-input-echeck {
    border-color: var(--wc-red, #d65d67);
}

/* Prevent red border on account name field during typing */
.woocommerce form #anet-bank-account-name-div.woocommerce-invalid input.text-input-echeck {
    border-color: var(--wc-form-border-color, #ddd);
}

/* Show red border for account name only when explicitly validated (blur, form submission) */
.woocommerce form #anet-bank-account-name-div.woocommerce-invalid.force-validation input.text-input-echeck {
    border-color: var(--wc-red, #d65d67);
}

/* Ensure empty required fields show red border when validated */
.woocommerce form #anet-bank-account-name-div.woocommerce-invalid-required-field.force-validation input.text-input-echeck {
    border-color: var(--wc-red, #d65d67);
}

.woocommerce-js form .form-row.woocommerce-invalid input.text-input-echeck {
    border-color: #d65d67;
}

/* Form row pair layout */
.form-row-pair {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row-pair > .form-row {
    flex: 1;
    min-width: 200px;
}

/* Payment form wrapper spacing */
.anet-payment-form.anet-checkout-page {
    margin-left: 20px;
}

.anet-payment-form.anet-payment-methods-page {
    margin-left: 1px;
}

/* Responsive layout for mobile devices */
@media only screen and (max-width: 600px) {
    .anet-payment-form .text-input-echeck,
    .anet-payment-form select.text-input-echeck {
        width: 100% !important;
        max-width: 100%;
    }

    .form-row-pair {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-row-pair > .form-row {
        width: 100%;
        min-width: 100%;
    }

    .anet-card-number-label {
        display: inline-block;
        margin-top: 0;
    }
    
    .anet-payment-form.anet-checkout-page,
    .anet-payment-form.anet-payment-methods-page {
        margin-left: 0;
    }
}

/* Tablet and larger screens */
@media only screen and (min-width: 601px) {
    .anet-payment-form .form-row-pair > .form-row .text-input-echeck,
    .anet-payment-form .form-row-pair > .form-row select.text-input-echeck {
        width: 100% !important;
        max-width: 100%;
    }
}

/* eCheck Edit Form Styles */
.echeck-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.echeck-row .form-row {
    flex: 1;
    min-width: 200px;
}

@media only screen and (max-width: 600px) {
    .echeck-row {
        flex-direction: column;
    }
}

/* Additional styles for eCheck edit form */
#anet-echeck-edit-form {
    max-width: 600px;
}

#anet-echeck-edit-error {
    color: #b32d2e;
    margin-bottom: 12px;
    display: none;
}

#anet-echeck-edit-form .form-row select {
    height: 40px;
}

#anet-echeck-edit-form .form-row {
    margin-bottom: 1em;
}

#anet-echeck-save-btn {
    margin: 1em;
}

