/**
 * RevCent Payments Blocks CSS
 * Styles for the WooCommerce Blocks checkout integration
 */

.revcent-payment-description {
    margin-bottom: 1em;
    font-size: 14px;
    color: #666;
}

.revcent-payment-fields {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.revcent-card-field {
    display: flex;
    flex-direction: column;
    position: relative;
    margin-bottom: 1em;
}

.revcent-card-field label {
    position: absolute;
    left: 0.75em;
    top: 0.75em;
    font-size: 16px;
    color: #999;
    pointer-events: none;
    transition: all 0.2s ease;
    background: #fff;
    padding: 0 0.25em;
    z-index: 2;
}

.revcent-card-field input {
    padding: 0.75em;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.2s ease;
    background-color: #fff;
    position: relative;
    z-index: 1;
    width: 100%;
    box-sizing: border-box;
}

.revcent-card-field input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

/* Floating label effect */
.revcent-card-field input:focus + label,
.revcent-card-field label.active {
    top: -0.5em;
    left: 0.5em;
    font-size: 12px;
    color: #007cba;
    font-weight: 600;
}

.revcent-card-field input:focus + label {
    color: #007cba;
}
 
/* Force input fields to be empty initially and not inherit text */
.revcent-card-field input {
    text-indent: 0;
    text-align: left;
    vertical-align: baseline;
}

/* Override any potential text content from pseudo-elements */
.revcent-card-field input:empty::before {
    content: "";
}

.revcent-card-field input.error {
    border-color: #d63638;
    box-shadow: 0 0 0 1px #d63638;
}

.revcent-card-field input::placeholder {
    color: #999;
    opacity: 1;
}

/* Responsive design */
@media (min-width: 768px) {
    .revcent-payment-fields {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr;
        gap: 1em;
        align-items: end;
    }
    
    .revcent-card-field:first-child {
        grid-column: 1 / -1;
    }
}

/* WooCommerce Blocks specific styles */
.wc-block-checkout__payment-method .revcent-payment-fields {
    margin-top: 1em;
}

.wc-block-components-payment-method-label {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

/* Ensure proper label and input separation */
.revcent-card-field input[name="revcent_card_number"],
.revcent-card-field input[name="revcent_card_expiry"],
.revcent-card-field input[name="revcent_card_cvc"] {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

/* Ensure labels don't interfere with inputs */
.revcent-card-field label {
    display: block;
    margin: 0 0 0.5em 0;
    padding: 0;
    line-height: 1.4;
}

/* Clear any inherited content */
.revcent-card-field input::before,
.revcent-card-field input::after {
    content: none;
    display: none;
}

/* Error messages */
.revcent-field-error {
    color: #d63638;
    font-size: 12px;
    margin-top: 0.25em;
    display: block;
}

/* Loading state */
.revcent-payment-fields.loading {
    opacity: 0.6;
    pointer-events: none;
}

.revcent-payment-fields.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: revcent-spin 1s linear infinite;
}

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

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .revcent-payment-description {
        color: #ccc;
    }
    
    .revcent-card-field label {
        color: #fff;
    }
    
    .revcent-card-field input {
        background-color: #333;
        border-color: #555;
        color: #fff;
    }
    
    .revcent-card-field input:focus {
        border-color: #00a0d2;
        box-shadow: 0 0 0 1px #00a0d2;
    }
    
    .revcent-card-field input::placeholder {
        color: #999;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .revcent-card-field input {
        border-width: 2px;
    }
    
    .revcent-card-field input:focus {
        border-width: 3px;
    }
}