/**
 * Styles for Woo Auth Payment Blocks - Robust Compatibility Layout
 */

/* Container resets and normalization */
.wc-auth-payment-form {
    padding-top: 0.5rem;
    width: 100%;
    max-width: 100%;
}

.wc-auth-payment-form *,
.wc-auth-payment-form *::before,
.wc-auth-payment-form *::after {
    box-sizing: border-box !important;
}

.wc-auth-payment-main-label {
    display: block !important;
    margin: 0 0 0.5rem 0 !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: #444 !important;
    line-height: 1.4 !important;
    font-family: inherit !important;
}

/* The primary input container */
.wc-auth-payment-card-input-container {
    border: 1px solid #ccc !important;
    border-radius: 8px !important;
    background: #fff !important;
    overflow: hidden !important;
    transition: box-shadow 0.2s ease, border-color 0.2s ease !important;
    display: block !important;
    width: 100% !important;
    box-shadow: none !important;
    margin: 0 !important;
}

/* Row Styling */
.wc-auth-payment-card-number-wrapper {
    display: flex !important;
    align-items: center !important;
    border-bottom: 1px solid #ccc !important;
    padding: 0 0.75rem !important;
    transition: box-shadow 0.2s ease !important;
    background: transparent !important;
    border-top-left-radius: 8px !important;
    border-top-right-radius: 8px !important;
}

.wc-auth-payment-card-number-wrapper:focus-within {
    box-shadow: inset 0 0 0 2px #6772e5 !important;
    z-index: 10 !important;
    position: relative !important;
    border-color: #6772e5 !important;
}

.wc-auth-payment-card-number-wrapper.is-error {
    box-shadow: inset 0 0 0 1px #e54242 !important;
    z-index: 11 !important;
    position: relative !important;
    border-color: #e54242 !important;
    border-top-left-radius: 8px !important;
    border-top-right-radius: 8px !important;
}

.wc-auth-payment-card-details-wrapper {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
}

/* Defensive Input Reset - High Specificity */
.wc-auth-payment-form .wc-auth-payment-card-input-container input[type="text"],
.wc-auth-payment-form .wc-auth-payment-card-input-container input[type="password"] {
    border: none !important;
    background: transparent !important;
    padding: 0.75rem 0 !important;
    font-size: 1rem !important;
    line-height: normal !important;
    outline: none !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    color: #1e1e1e !important;
    box-shadow: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    font-family: inherit !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

.wc-auth-payment-form .wc-auth-payment-card-input-container input::placeholder {
    color: #888 !important;
    opacity: 1 !important;
    /* Firefox */
}

/* Card Number Input */
.wc-auth-payment-input-number {
    flex: 1 1 auto !important;
}

/* Card Brands Icons */
.wc-auth-payment-card-brands {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    width: 32px !important;
    height: 24px !important;
    margin-left: 8px !important;
    flex-shrink: 0 !important;
}

.wc-auth-payment-card-icon {
    height: 24px !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
    vertical-align: middle !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Expiry and CVC Normalization */
.wc-auth-payment-form .wc-auth-payment-card-input-container input.wc-auth-payment-input-expiry {
    flex: 1 1 50% !important;
    padding-left: 0.75rem !important;
    transition: box-shadow 0.2s ease !important;
    border-bottom-left-radius: 8px !important;
}

.wc-auth-payment-form .wc-auth-payment-card-input-container input.wc-auth-payment-input-expiry:focus {
    box-shadow: inset 0 0 0 2px #6772e5 !important;
    z-index: 10 !important;
    position: relative !important;
}

.wc-auth-payment-form .wc-auth-payment-card-input-container input.wc-auth-payment-input-expiry.is-error {
    box-shadow: inset 0 0 0 1px #e54242 !important;
    z-index: 11 !important;
    position: relative !important;
    border-bottom-left-radius: 8px !important;
}

/* CVC Wrapper and Toggle */
.wc-auth-payment-form .wc-auth-payment-card-input-container .wc-auth-payment-cvc-wrapper {
    position: relative !important;
    flex: 1 1 50% !important;
    display: flex !important;
    align-items: center !important;
    transition: box-shadow 0.2s ease !important;
    border-left: 1px solid #ccc !important;
    border-bottom-right-radius: 8px !important;
}

.wc-auth-payment-cvc-wrapper[data-focused="true"],
.wc-auth-payment-cvc-wrapper:focus-within {
    box-shadow: inset 0 0 0 2px #6772e5 !important;
    z-index: 10 !important;
    position: relative !important;
}

.wc-auth-payment-form .wc-auth-payment-card-input-container input.wc-auth-payment-input-cvc {
    padding-left: 0.75rem !important;
    padding-right: 38px !important;
}

.wc-auth-payment-cvc-toggle {
    position: absolute !important;
    right: 4px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: normal !important;
    color: #aeaeae !important;
    transition: opacity 0.2s ease, transform 0.1s ease !important;
    z-index: 12 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    box-shadow: none !important;
    appearance: none !important;
}

.wc-auth-payment-cvc-toggle:focus {
    outline: none !important;
    box-shadow: none !important;
}

.wc-auth-payment-cvc-toggle:active {
    transform: translateY(-50%) scale(0.9) !important;
}

.wc-auth-payment-cvc-toggle-icon {
    width: 20px !important;
    height: 20px !important;
    opacity: 0.5 !important;
    transition: opacity 0.2s ease !important;
    vertical-align: middle !important;
    pointer-events: none !important;
}

.wc-auth-payment-cvc-toggle:hover .wc-auth-payment-cvc-toggle-icon {
    opacity: 0.9 !important;
}

/* Error Message */
.wc-auth-payment-error-message {
    color: #e54242 !important;
    font-size: 0.8125rem !important;
    margin-top: 0.625rem !important;
    padding-left: 0.25rem !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    animation: authPaymentSlideDown 0.25s ease-out !important;
    display: block !important;
}

@keyframes authPaymentSlideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Specific resets for common themes (Astra, OceanWP, Woodmart, etc.) */
.wc-auth-payment-form input::-ms-clear {
    display: none !important;
}

/* Hide default browser icons for numbers if any */
.wc-auth-payment-form input::-webkit-outer-spin-button,
.wc-auth-payment-form input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}