/* Braintree Payment Form Styles */

/* Match the existing payment form container */
.braintree-payment-form {
    /* Inherits from parent payment form */
}

/* Match the .row style from payment form - 41px height */
.braintree-payment-form .row {
    height: 41px;
    margin-bottom: 0;
}

/* Match the .payment-label style - 250px width, inline-block */
.braintree-payment-form .payment-label {
    display: inline-block;
    width: 250px;
    vertical-align: middle;
}

/* Style the hosted fields to match existing inputs - ALL 155px width */
.braintree-payment-form .hosted-field {
    display: inline-block;
    width: 155px;
    height: 28px;
    padding: 4px 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    font-family: helvetica, tahoma, calibri, sans-serif;
    background-color: #fff;
    vertical-align: middle;
    box-sizing: border-box;
}

/* Card number field - same 155px width as all other fields */
#braintree-card-number {
    width: 155px;
}

/* Expiration fields - split the 155px total width between month and year */
#braintree-expiration-month {
    width: 75px;
    margin-right: 5px;
}

#braintree-expiration-year {
    width: 75px;
}

/* CVV field - same 155px width as all other fields */
#braintree-cvv {
    width: 155px;
}

/* Match the name input field exactly - 155px width */
.braintree-payment-form input[type="text"] {
    width: 155px !important;
    padding: 4px 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    vertical-align: middle;
    box-sizing: border-box;
}

/* PO select should also be 155px */
.braintree-payment-form select {
    width: 155px;
    height: 28px;
    padding: 4px 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    vertical-align: middle;
    box-sizing: border-box;
}

/* Card type display - same 155px width as all other fields */
.card-type-display {
    display: inline-block;
    width: 155px;
    height: 28px;
    padding: 4px 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    font-family: helvetica, tahoma, calibri, sans-serif;
    background-color: #f9f9f9;
    vertical-align: middle;
    line-height: 20px;
    box-sizing: border-box;
}

/* Card type inline display next to card number */
.card-type {
    margin-left: 10px;
    font-weight: normal;
    color: #666;
    font-size: 12px;
}

/* Note: Hosted field validation states are handled in the Braintree JS configuration */

/* Error message styling */
.braintree-payment-form .error-message {
    color: #fff;
    background: #e74c3c;
    text-align: center;
    border-radius: 8px;
    padding: 4px;
    width: 300px;
    margin: auto auto 10px auto;
}

/* Loading state */
.braintree-loading {
    text-align: center;
    padding: 20px;
}

/* Required star */
.star.red {
    color: #e74c3c;
}

/* Submit button styling */
.braintree-submit-button {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.braintree-submit-button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.braintree-payment-form .braintree-hosted-fields-invalid {
    border: 2px solid #e74c3c;
}

/* ========================================
   APPROVAL AREA SPECIFIC STYLES 
   For the popup payment form in approval portal
   ======================================== */

/* Override default row height for approval popup */
.approval-area #payment-wrapper .row {
    height: auto !important;
    min-height: 45px;
    margin-bottom: 10px;
    clear: both;
}

/* Make labels inline-block to match standard layout */
.approval-area .payment-label {
    display: inline-block !important;
    width: 180px !important;
    vertical-align: top;
    padding-top: 8px;
}

/* Style hosted fields in approval popup - match standard input width */
.approval-area .hosted-field {
    display: inline-block !important;
    width: 250px !important;
    height: 32px;
    padding: 6px 8px;
    border: 1px solid #ccc;
    background: white;
    font-size: 14px;
    font-family: helvetica, tahoma, calibri, sans-serif;
    box-sizing: border-box;
    vertical-align: middle;
}

/* Card number field specifically */
.approval-area #credit-card-number {
    display: inline-block !important;
    width: 250px !important;
}

/* Expiration fields side by side - override inline styles */
.approval-area #credit-card-expiration-mm {
    display: inline-block !important;
    width: 80px !important;
    margin-right: 5px;
}

.approval-area #credit-card-expiration-yyyy {
    display: inline-block !important;
    width: 100px !important;
    margin-left: 0 !important;
}

/* CVV field */
.approval-area #credit-card-cvv {
    display: inline-block !important;
    width: 250px !important;
}

/* Text inputs in approval popup - Name on Card, PO Number */
.approval-area input[type="text"],
.approval-area input[type="email"] {
    display: inline-block;
    width: 250px !important;
    height: 32px;
    padding: 6px 8px;
    border: 1px solid #ccc;
    font-size: 14px;
    box-sizing: border-box;
    vertical-align: middle;
}

/* Card type indicator */
.approval-area #card-type {
    color: #666;
    font-weight: normal;
    font-size: 12px;
    margin-left: 5px;
}

/* Error message in approval popup */
.approval-area #payment-error {
    padding: 10px;
    background: #fee;
    border: 1px solid #fcc;
    color: #c00;
    margin-bottom: 10px;
    border-radius: 3px;
}

/* Validation states for hosted fields */
.approval-area .hosted-field.complete {
    border-color: #2ecc71;
}

.approval-area .hosted-field.incomplete {
    border-color: #ccc;
}

.approval-area .hosted-field.braintree-hosted-fields-invalid {
    border-color: #e74c3c;
}

/* Checkout navigation in approval popup */
.approval-area .checkout-navigation {
    clear: both;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.approval-area .checkout-navigation button {
    margin-right: 10px;
}

/* Loading spinner for payment processing */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-left: 5px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Info state for payment messages */
.approval-area #payment-error.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Disabled button state */
.approval-area .payment-form-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Ensure Braintree hosted field iframe is visible */
.approval-area .hosted-field iframe {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Fix for empty hosted fields */
.approval-area .hosted-field:empty::before {
    content: '';
    display: inline-block;
    width: 100%;
    height: 100%;
}

/* ========================================
   reCAPTCHA STYLES
   ======================================== */

/* reCAPTCHA row - needs more height for the widget */
.braintree-payment-form .recaptcha-row {
    height: auto !important;
    min-height: 90px;
    margin-top: 15px;
    margin-bottom: 15px;
}

/* reCAPTCHA container */
#recaptcha-container {
    display: inline-block;
    vertical-align: top;
}

/* reCAPTCHA error message */
.braintree-payment-form .recaptcha-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    display: block;
    margin-left: 250px;
}

/* Approval area reCAPTCHA */
.approval-area .recaptcha-row {
    height: auto !important;
    min-height: 75px;
}

.approval-area #recaptcha-container {
    display: inline-block;
    vertical-align: top;
}

.approval-area .recaptcha-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    display: block;
    margin-left: 180px;
}