/* Rebill Payment Form Styles */

/*
 * Typography Isolation
 * We use !important to ensure theme styles do not override our specific look.
 * Using a modern system font stack for a premium, clean look.
 */
.rebill-payment-form {
    margin-top: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.rebill-payment-form * {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    box-sizing: border-box;
}

/* Logo Container */
.rebill-logo-container {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.rebill-logo-container img {
    height: 26px; /* Slightly smaller for better proportion */
    width: auto;
    max-width: 150px;
    border: none;
    box-shadow: none;
}

/* Form Container */
.rebill-form-container {
    background: #ffffff;
    padding: 24px;
    border-radius: 12px; /* Slightly more rounded for premium feel */
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); /* Softer shadow */
}

/* Form Row Layout */
.rebill-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px; /* Increased gap for better separation */
    margin-bottom: 20px;
}

.rebill-form-row.full-width {
    grid-template-columns: 1fr;
}

/* Form Field Styling */
.rebill-payment-form .form-row {
    margin: 0;
    width: 100%;
}

.rebill-payment-form .form-row label {
    display: block;
    margin-bottom: 8px !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    color: #374151 !important;
    line-height: 1.5 !important;
    text-transform: none !important; /* Prevent themes from forcing uppercase */
    letter-spacing: normal !important;
}

.rebill-payment-form .form-row .required {
    color: #dc2626 !important;
    margin-left: 2px;
    text-decoration: none !important;
}

.rebill-payment-form .input-text,
.rebill-payment-form select {
    display: block;
    width: 100% !important;
    height: 48px !important;
    padding: 0 16px !important;
    font-size: 15px !important;
    line-height: normal !important;
    color: #111827 !important;
    background-color: #f9fafb !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.2s ease-in-out !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Custom Select Arrow */
.rebill-payment-form select {
    padding-right: 32px !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
    background-position: right 0.5rem center !important;
    background-repeat: no-repeat !important;
    background-size: 1.5em 1.5em !important;
}

.rebill-payment-form .input-text:focus,
.rebill-payment-form select:focus {
    outline: none !important;
    border-color: #3b82f6 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.rebill-payment-form .input-text::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}

/* Section Headers */
.rebill-section-header {
    margin: 28px 0 16px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid #e5e7eb !important;

    /* Reduced size as requested */
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #111827 !important;

    /* Reset other potential theme properties */
    text-transform: none !important;
    letter-spacing: normal !important;
    line-height: 1.4 !important;
}

/* Card Number Field */
.rebill-payment-form input[name="rebill_card_number"] {
    /* Use the forced clean font stack */
    letter-spacing: 0.5px !important;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .rebill-form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .rebill-form-container {
        padding: 16px;
    }

    .rebill-payment-form .input-text,
    .rebill-payment-form select {
        font-size: 16px !important;
        height: 44px !important;
    }
}

/* SDK Checkout Component */
#rebill-sdk-wrapper {
    margin-top: 12px;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

#rebill-sdk-mount,
#rebill-sdk-container {
    min-height: 60px;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

rebill-checkout {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    contain: inline-size !important;
}

/* Contener dentro del bloque de pago de WooCommerce Blocks */
.wc-block-checkout__payment-method,
.wp-block-woocommerce-checkout-payment-block {
    overflow: hidden !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.wc-block-components-checkout-step__content,
.wc-block-components-radio-control-accordion-content {
    overflow: hidden !important;
}

.rebill-sdk-msg {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    margin: 0;
}

.rebill-sdk-msg--info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.rebill-sdk-msg--success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    font-weight: 600;
}

.rebill-sdk-msg--error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Error States */
.rebill-payment-form .woocommerce-invalid .input-text,
.rebill-payment-form .woocommerce-invalid select {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

.rebill-payment-form .woocommerce-invalid .input-text:focus,
.rebill-payment-form .woocommerce-invalid select:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}
