/**
 * Form Validation Styles
 * Visual feedback for validation states
 */

/* ==================== Input States ==================== */

/* Valid state - green border */
.form-control.is-valid,
.form-select.is-valid,
.revo-input.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);
}

.form-control.is-valid:focus,
.form-select.is-valid:focus,
.revo-input.is-valid:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Invalid state - red border */
.form-control.is-invalid,
.form-select.is-invalid,
.revo-input.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-invalid:focus,
.form-select.is-invalid:focus,
.revo-input.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* ==================== Feedback Messages ==================== */

.valid-feedback,
.invalid-feedback {
    display: none;
    /*width: 100%;*/
    margin-top: 0.25rem;
    font-size: 0.875em;
}

.valid-feedback {
    color: #28a745;
}

.invalid-feedback {
    color: #dc3545;
}

/* Show feedback when validation state is active */
.is-valid ~ .valid-feedback {
    display: block;
}

.is-invalid ~ .invalid-feedback {
    display: block;
}

/* ==================== Password Strength Indicator ==================== */

.password-strength-indicator {
    margin-top: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.strength-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.strength-bar-fill {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 3px;
}

.strength-bar-fill.weak {
    background: linear-gradient(90deg, #dc3545, #e74c3c);
}

.strength-bar-fill.fair {
    background: linear-gradient(90deg, #ffc107, #ffca28);
}

.strength-bar-fill.good {
    background: linear-gradient(90deg, #17a2b8, #20c997);
}

.strength-bar-fill.strong {
    background: linear-gradient(90deg, #28a745, #34ce57);
}

.strength-text {
    font-size: 0.875rem;
    font-weight: 600;
}

.strength-text.weak {
    color: #dc3545;
}

.strength-text.fair {
    color: #ffc107;
}

.strength-text.good {
    color: #17a2b8;
}

.strength-text.strong {
    color: #28a745;
}

/* ==================== Requirements List ==================== */

.requirements-list {
    display: grid;
    gap: 6px;
}

.requirement {
    display: flex;
    align-items: center;
    font-size: 0.8125rem;
    color: #6c757d;
    transition: color 0.2s ease;
}

.requirement.met {
    color: #28a745;
}

.requirement .req-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 6px;
    font-weight: bold;
    line-height: 18px;
    text-align: center;
}

/* ==================== Character Counter ==================== */

.char-counter {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    text-align: right;
    transition: color 0.2s ease;
}

/* ==================== Loading State ==================== */

.form-control.loading,
.revo-input.loading {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='xMidYMid'%3e%3ccircle cx='50' cy='50' fill='none' stroke='%236c757d' stroke-width='10' r='35' stroke-dasharray='164.93361431346415 56.97787143782138'%3e%3canimateTransform attributeName='transform' type='rotate' repeatCount='indefinite' dur='1s' values='0 50 50;360 50 50' keyTimes='0;1'%3e%3c/animateTransform%3e%3c/circle%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);
}

/* ==================== Disabled State ==================== */

.form-control:disabled,
.form-select:disabled,
.revo-input:disabled {
    background-color: #e9ecef;
    opacity: 0.7;
    cursor: not-allowed;
}

/* ==================== Tooltip Errors ==================== */

.field-tooltip-error {
    position: relative;
}

.field-tooltip-error .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #dc3545;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.field-tooltip-error .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #dc3545 transparent transparent transparent;
}

.field-tooltip-error:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ==================== Responsive ==================== */

@media (max-width: 576px) {
    .password-strength-indicator {
        padding: 8px;
    }
    
    .requirements-list {
        gap: 4px;
    }
    
    .requirement {
        font-size: 0.75rem;
    }
    
    .strength-text {
        font-size: 0.8125rem;
    }
}

/* ==================== Animations ==================== */

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ==================== Focus Indicators ==================== */

.form-control:focus,
.form-select:focus,
.revo-input:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* ==================== Bootstrap Compatibility ==================== */

.was-validated .form-control:valid,
.was-validated .form-select:valid {
    border-color: #28a745;
}

.was-validated .form-control:invalid,
.was-validated .form-select:invalid {
    border-color: #dc3545;
}

