/**
 * Universal Form Validation Pro - Frontend Styles
 */

/* Error message styles */
.ufvp-error {
    color: #ff0000;
    font-size: 14px;
    font-weight: 500;
    margin: 5px 0;
    padding: 8px 12px;
    background-color: #fff5f5;
    border: 1px solid #ffcccc;
    border-radius: 4px;
    display: block;
    position: relative;
    animation: ufvp-slide-down 0.3s ease-out;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Error field highlighting */
.ufvp-error-field {
    border-color: #ff0000 !important;
    box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.2) !important;
    background-color: #fffafa !important;
}

/* Positioning for error messages */
.ufvp-error.top {
    margin-bottom: 8px;
}

.ufvp-error.bottom {
    margin-top: 8px;
}

.ufvp-error.inline {
    display: inline-block;
    margin-left: 10px;
    vertical-align: middle;
}

/* Animation for error appearance */
@keyframes ufvp-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form field improvements */
input[type="text"].ufvp-error-field,
input[type="email"].ufvp-error-field,
input[type="tel"].ufvp-error-field,
input[type="number"].ufvp-error-field,
textarea.ufvp-error-field,
select.ufvp-error-field {
    transition: all 0.3s ease;
}

/* Error icon */
.ufvp-error::before {
    content: "⚠";
    margin-right: 8px;
    font-weight: bold;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ufvp-error {
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .ufvp-error.inline {
        display: block;
        margin-left: 0;
        margin-top: 8px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ufvp-error {
        background-color: #2d1b1b;
        border-color: #5c2c2c;
        color: #ff6b6b;
    }
    
    .ufvp-error-field {
        background-color: #2d1b1b !important;
        border-color: #ff6b6b !important;
    }
}

/* Integration with popular form plugins */

/* Contact Form 7 */
.wpcf7-form .ufvp-error {
    margin-top: 5px;
    margin-bottom: 15px;
}

.wpcf7-form input.ufvp-error-field,
.wpcf7-form textarea.ufvp-error-field {
    border-color: #ff0000 !important;
}

/* WPForms */
.wpforms-container .ufvp-error {
    margin-top: 5px;
    margin-bottom: 10px;
}

.wpforms-container input.ufvp-error-field,
.wpforms-container textarea.ufvp-error-field {
    border-color: #ff0000 !important;
}

/* Gravity Forms */
.gform_wrapper .ufvp-error {
    margin-top: 5px;
    margin-bottom: 10px;
}

.gform_wrapper input.ufvp-error-field,
.gform_wrapper textarea.ufvp-error-field {
    border-color: #ff0000 !important;
}

/* Elementor Forms */
.elementor-field-group .ufvp-error {
    margin-top: 5px;
    margin-bottom: 15px;
}

.elementor-field-group input.ufvp-error-field,
.elementor-field-group textarea.ufvp-error-field {
    border-color: #ff0000 !important;
}

/* Ninja Forms */
.nf-form-cont .ufvp-error {
    margin-top: 5px;
    margin-bottom: 10px;
}

.nf-form-cont input.ufvp-error-field,
.nf-form-cont textarea.ufvp-error-field {
    border-color: #ff0000 !important;
}

/* Formidable Forms */
.frm_forms .ufvp-error {
    margin-top: 5px;
    margin-bottom: 10px;
}

.frm_forms input.ufvp-error-field,
.frm_forms textarea.ufvp-error-field {
    border-color: #ff0000 !important;
}

/* Caldera Forms */
.caldera-grid .ufvp-error {
    margin-top: 5px;
    margin-bottom: 10px;
}

.caldera-grid input.ufvp-error-field,
.caldera-grid textarea.ufvp-error-field {
    border-color: #ff0000 !important;
}

/* Accessibility improvements */
.ufvp-error {
    role: alert;
    aria-live: polite;
}

.ufvp-error-field {
    aria-invalid: true;
    aria-describedby: true;
}

/* Print styles */
@media print {
    .ufvp-error {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ufvp-error {
        border-width: 2px;
        font-weight: bold;
    }
    
    .ufvp-error-field {
        border-width: 2px !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ufvp-error {
        animation: none;
    }
    
    input[type="text"].ufvp-error-field,
    input[type="email"].ufvp-error-field,
    input[type="tel"].ufvp-error-field,
    input[type="number"].ufvp-error-field,
    textarea.ufvp-error-field,
    select.ufvp-error-field {
        transition: none;
    }
}

/* Focus styles for accessibility */
.ufvp-error-field:focus {
    outline: 2px solid #ff0000;
    outline-offset: 2px;
}

/* Success state (optional) */
.ufvp-success {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2) !important;
}

/* Loading state */
.ufvp-validating {
    position: relative;
}

.ufvp-validating::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: ufvp-spin 1s linear infinite;
}

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