/* ========================================
   FORM VALIDATION STYLES
   Visual feedback for form inputs
   ======================================== */

.form-group {
    position: relative;
    margin-bottom: 1.5rem;
}

/* Validation feedback messages */
.validation-feedback {
    display: none;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.validation-feedback.valid {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.validation-feedback.invalid {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Input states */
input.is-valid,
textarea.is-valid,
select.is-valid {
    border-color: #10b981 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2310b981'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

input.is-invalid,
textarea.is-invalid,
select.is-invalid {
    border-color: #ef4444 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23ef4444'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

/* Focus states */
input.is-valid:focus,
textarea.is-valid:focus {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

input.is-invalid:focus,
textarea.is-invalid:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* Form error message */
.form-error-message {
    display: none;
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    border-radius: 8px;
    color: #ef4444;
    font-weight: 500;
}

/* Loading state for submit button */
button[type="submit"].loading,
.btn-submit.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

button[type="submit"].loading::after,
.btn-submit.loading::after {
    content: '';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

/* Success message */
.form-success-message {
    display: none;
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid #10b981;
    border-radius: 8px;
    color: #10b981;
    font-weight: 500;
}

/* Character counter */
.character-counter {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: right;
    margin-top: 0.25rem;
}

.character-counter.over-limit {
    color: #ef4444;
}

/* Required field indicator */
.required-indicator {
    color: #ef4444;
    margin-left: 0.25rem;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    input,
    textarea,
    select {
        transition: none !important;
    }
}
