/**
 * Input Validation Styles
 * Provides visual feedback for form validation
 */

/* Valid input styling */
.is-valid {
    border-color: #28a745 !important;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.94-.94 1.93 1.93 3.53-3.53.94.94L4.16 9.66z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Invalid input styling */
.is-invalid {
    border-color: #dc3545 !important;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 1.4 1.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Error message styling */
.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

.valid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #28a745;
}

/* Input group validation */
.input-group .is-invalid ~ .invalid-feedback {
    display: block;
}

.input-group .is-valid ~ .valid-feedback {
    display: block;
}

/* Form validation summary */
.validation-summary {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
}

.validation-summary.success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

/* Loading state for inputs */
.input-loading {
    position: relative;
}

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

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

/* Input masks styling */
.masked-input {
    font-family: monospace;
    letter-spacing: 1px;
}

/* Validation icons */
.validation-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
}

.validation-icon.success {
    color: #28a745;
}

.validation-icon.error {
    color: #dc3545;
}

/* Tooltip styling for validation messages */
.validation-tooltip {
    position: relative;
    display: inline-block;
}

.validation-tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.validation-tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Real-time validation indicators */
.validation-progress {
    height: 4px;
    background-color: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 5px;
}

.validation-progress-bar {
    height: 100%;
    background-color: #007bff;
    transition: width 0.3s ease;
}

.validation-progress-bar.weak { background-color: #dc3545; }
.validation-progress-bar.fair { background-color: #ffc107; }
.validation-progress-bar.good { background-color: #17a2b8; }
.validation-progress-bar.strong { background-color: #28a745; }

/* Mobile responsive validation */
@media (max-width: 768px) {
    .invalid-feedback,
    .valid-feedback {
        font-size: 0.8em;
    }
    
    .validation-summary {
        padding: 0.5rem 1rem;
        font-size: 0.9em;
    }
}

/* Focus states for better accessibility */
.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.is-valid:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Radio group validation styles */
.radio-group-invalid {
    border: 2px solid #dc3545 !important;
    border-radius: 0.25rem;
    background-color: rgba(220, 53, 69, 0.1);
    padding: 0.25rem;
    margin: 0.125rem 0;
}

.radio-group-invalid label {
    color: #dc3545 !important;
}

/* Course date selection validation */
.course_date.is-invalid {
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.1);
}

.course_date.is-valid {
    border-color: #28a745 !important;
    background-color: rgba(40, 167, 69, 0.1);
}

