/**
 * Frontend Styles for WP Invoice Record
 * 
 * Styles for the invoice registration form with responsive design
 * and modern UI components.
 */

/* Form Container */
.wp-invoice-record-form {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wp-invoice-record-form h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

/* Form Structure */
#formulario-registro {
    width: 100%;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-field {
    margin-bottom: 15px;
}

.form-field label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
}

/* Input Fields */
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="tel"],
.form-field select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    background-color: #fff;
    transition: border-color 0.3s ease;
}

.form-field input[type="text"]:focus,
.form-field input[type="email"]:focus,
.form-field input[type="tel"]:focus,
.form-field select:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Specific field styling */
.d-flexf {
    flex: 1;
}

/* Select Fields */
.form-field select {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23666' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Checkbox Field */
.checkbox-field {
    position: relative;
}

.checkbox-field label {
    display: flex;
    align-items: flex-start;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    margin-top: 2px;
    flex-shrink: 0;
}

.terms-text {
    font-weight: normal;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    margin-top: 5px;
    display: block;
}

/* reCAPTCHA Field */
.recaptcha-field {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

/* Submit Button */
.submit-field {
    text-align: center;
    margin-top: 20px;
}

.submit-button {
    width: 50%;
    min-width: 200px;
    padding: 12px 20px;
    background-color: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-transform: none;
}

.submit-button:hover {
    background-color: #333;
}

.submit-button:disabled,
.submit-button.disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Pre-filled Fields */
input.prefilled,
select.prefilled {
    background-color: #f0f8ff;
    border-color: #4a90e2;
}



/* Loading state for document field */
.form-field.loading::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-top: 2px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error Messages */
.error-message {
    display: block;
    color: #dc3232;
    font-size: 12px;
    margin-top: 5px;
    font-weight: 500;
}

/* Feedback Messages */
.feedback-message {
    margin-top: 15px;
    text-align: center;
}

.feedback-message p {
    margin: 0;
    margin-bottom: 12px;
    padding: 10px !important;
    border-radius: 4px;
    font-weight: 500;
}

.feedback-message p.success {
    color: #0088e2 !important;
    background-color: #f0f8ff;
    border: 1px solid #0088e2;
    font-size: 18px;
    font-weight: bold;
}

.feedback-message p.error {
    color: #dc3232;
    background-color: #ffeaea;
    border: 1px solid #dc3232;
}

/* Form Validation States */
.form-field input.invalid {
    border-color: #dc3232;
    box-shadow: 0 0 0 1px #dc3232;
}

.form-field input.valid {
    border-color: #46b450;
    box-shadow: 0 0 0 1px #46b450;
}

/* Loading States */
.form-field.loading input,
.form-field.loading select {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23666' d='M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z' opacity='.25'/%3E%3Cpath fill='%23666' d='M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z'%3E%3CanimateTransform attributeName='transform' dur='0.75s' repeatCount='indefinite' type='rotate' values='0 12 12;360 12 12'/%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .wp-invoice-record-form {
        margin: 10px;
        padding: 15px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .d-flexf {
        width: 100%;
    }
    
    .submit-button {
        width: 100%;
        min-width: auto;
    }
    
    .recaptcha-field {
        overflow-x: auto;
    }
}

@media screen and (max-width: 480px) {
    .wp-invoice-record-form {
        margin: 5px;
        padding: 10px;
    }
    
    .form-field label {
        font-size: 13px;
    }
    
    .form-field input[type="text"],
    .form-field input[type="email"],
    .form-field input[type="tel"],
    .form-field select {
        font-size: 13px;
        padding: 8px 10px;
    }
    
    .submit-button {
        font-size: 14px;
        padding: 10px 16px;
    }
}

/* Print Styles */
@media print {
    .wp-invoice-record-form {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .submit-button,
    .recaptcha-field {
        display: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .form-field input[type="text"],
    .form-field input[type="email"],
    .form-field input[type="tel"],
    .form-field select {
        border-width: 2px;
    }
    
    .submit-button {
        border: 2px solid #fff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .form-field input[type="text"],
    .form-field input[type="email"],
    .form-field input[type="tel"],
    .form-field select,
    .submit-button {
        transition: none;
    }
}
