/* ========================================
   FORM VALIDATION STYLES
======================================== */

/* Input States */
.form-control.is-invalid,
.form-select.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' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%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);
}

.form-control.is-valid,
.form-select.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' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%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-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Password Strength Meter */
.password-strength-meter {
    margin-top: 8px;
}

.strength-bar {
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 5px;
}

.strength-bar-fill {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-text {
    font-size: 0.8rem;
    color: #6c757d;
}

.strength-text span {
    font-weight: 600;
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    top: 20px;
    right: -300px;
    min-width: 300px;
    padding: 15px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: right 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-notification.show {
    right: 20px;
}

.toast-notification::before {
    content: '';
    width: 4px;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 8px 0 0 8px;
}

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

.toast-error::before {
    background: #dc3545;
}

.toast-success {
    border-left: 4px solid #28a745;
}

.toast-success::before {
    background: #28a745;
}

.toast-info {
    border-left: 4px solid #17a2b8;
}

.toast-info::before {
    background: #17a2b8;
}

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

.toast-warning::before {
    background: #ffc107;
}

/* Input Focus Enhancement */
.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Floating Labels (Optional Enhancement) */
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: #667eea;
}

/* Required Field Indicator */
label.required::after {
    content: ' *';
    color: #dc3545;
}

/* Loading State for Forms */
.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Input Groups */
.input-group .form-control:focus {
    z-index: 3;
}

/* Checkbox/Radio Validation */
.form-check-input.is-invalid ~ .form-check-label {
    color: #dc3545;
}

.form-check-input.is-valid ~ .form-check-label {
    color: #28a745;
}

/* Select2 Validation (if used) */
.select2-container--default .select2-selection--single.is-invalid {
    border-color: #dc3545;
}

/* File Input Validation */
input[type="file"].is-invalid {
    border-color: #dc3545;
}

/* Character Counter */
.char-counter {
    font-size: 0.8rem;
    color: #6c757d;
    text-align: right;
    margin-top: 4px;
}

.char-counter.over-limit {
    color: #dc3545;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .toast-notification {
        min-width: calc(100% - 40px);
        right: -100%;
    }
    
    .toast-notification.show {
        right: 20px;
    }
}

