/**
 * 🎯 FORM VALIDATION STYLES
 * Dedicated CSS file for validation-related styles
 * Moved from inline styles in quote.ejs for better performance
 */

/* Validation Message Styles */
.validation-message {
    background: #FEF2F2;
    color: #DC2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    border-left: 4px solid #DC2626;
    font-size: 14px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.validation-message.show {
    opacity: 1;
    transform: translateY(0);
}

/* Service Options Error State */
.service-options.error {
    animation: shake 0.3s ease-in-out;
}

/* Form Group Error State */
.form-group.shake-error {
    animation: shake 0.3s ease-in-out;
}

/* Generic error shake (matches JS usage adding 'shake-error' to any wrapper) */
.shake-error {
    animation: shake 0.6s ease-in-out;
    border-color: #dc3545 !important;
}

.shake-error input {
    border-color: #dc3545 !important;
}

/* Shake Animation Keyframes */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Error States for Form Controls */
.form-control.is-invalid {
    border-color: #DC2626;
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.25);
}

.form-control.is-valid {
    border-color: #059669;
    box-shadow: 0 0 0 0.2rem rgba(5, 150, 105, 0.25);
}

/* Invalid Feedback Styling */
.invalid-feedback {
    display: block;
    color: #DC2626;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    line-height: 1.4;
}

/* Valid Feedback Styling */
.valid-feedback {
    display: block;
    color: #059669;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    line-height: 1.4;
}

/* Validation Icons */
.form-control.is-invalid {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc2626'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m6 2 0 4'/%3e%3cpath d='m6 8 0 0'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem 1rem;
    padding-right: 2.5rem;
}

.form-control.is-valid {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23059669'%3e%3cpath d='m3 6 2 2 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem 1rem;
    padding-right: 2.5rem;
}

/* Success Message Styles */
.success-message {
    background: #ECFDF5;
    color: #059669;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    border-left: 4px solid #059669;
    font-size: 14px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.success-message.show {
    opacity: 1;
    transform: translateY(0);
}

/* Form Control Focus States with Validation */
.form-control:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
    outline: 0;
}

.form-control.is-invalid:focus {
    border-color: #DC2626;
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.25);
}

.form-control.is-valid:focus {
    border-color: #059669;
    box-shadow: 0 0 0 0.2rem rgba(5, 150, 105, 0.25);
}

/* Validation States for Different Input Types */
select.form-control.is-invalid,
textarea.form-control.is-invalid {
    border-color: #DC2626;
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.25);
}

select.form-control.is-valid,
textarea.form-control.is-valid {
    border-color: #059669;
    box-shadow: 0 0 0 0.2rem rgba(5, 150, 105, 0.25);
}

/* Floating Label Validation States */
.buggy-quote-floating-field .buggy-quote-input.is-invalid {
    border-color: #DC2626;
}

.buggy-quote-floating-field .buggy-quote-input.is-valid {
    border-color: #059669;
}

.buggy-quote-floating-field .buggy-quote-input.is-invalid:focus ~ .buggy-quote-label,
.buggy-quote-floating-field.has-value .buggy-quote-input.is-invalid ~ .buggy-quote-label {
    color: #DC2626;
}

.buggy-quote-floating-field .buggy-quote-input.is-valid:focus ~ .buggy-quote-label,
.buggy-quote-floating-field.has-value .buggy-quote-input.is-valid ~ .buggy-quote-label {
    color: #059669;
}

/* Validation Toast Notification */
.validation-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 16px 20px;
    max-width: 400px;
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.validation-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.validation-toast-error {
    border-left: 4px solid #DC2626;
}

.validation-toast-success {
    border-left: 4px solid #059669;
}

.validation-toast-warning {
    border-left: 4px solid #F59E0B;
}

.validation-toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.validation-toast-error .validation-toast-content i {
    color: #DC2626;
    font-size: 20px;
}

.validation-toast-success .validation-toast-content i {
    color: #059669;
    font-size: 20px;
}

.validation-toast-warning .validation-toast-content i {
    color: #F59E0B;
    font-size: 20px;
}

.validation-toast-content span {
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}

/* Validation Shake Animation for Fields */
.validation-shake {
    animation: validation-shake 0.5s ease-in-out;
}

@keyframes validation-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .validation-toast {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
    }

    .validation-toast.show {
        transform: translateY(0);
    }
}
