/**
 * Real-time Validation Styles for Fluent Forms
 */

/* Validation Feedback Container */
.rm-validation-feedback {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
    display: none;
    animation: slideDown 0.3s ease-out;
}

.rm-validation-feedback:not(:empty) {
    display: block;
}

/* Checking State */
.rm-validation-feedback.checking {
    background-color: #f0f6fc;
    border: 1px solid #d0e3f5;
    color: #0969da;
}

/* Success State */
.rm-validation-feedback.success {
    background-color: #dff6dd;
    border: 1px solid #acf2a8;
    color: #1a7f37;
}

/* Warning State (Medium Password) */
.rm-validation-feedback.warning {
    background-color: #fff8e1;
    border: 1px solid #ffe082;
    color: #f57c00;
}

/* Error State */
.rm-validation-feedback.error {
    background-color: #ffebe9;
    border: 1px solid #f5c7c7;
    color: #cf222e;
}

/* Icons */
.rm-validation-feedback .icon {
    display: inline-block;
    margin-right: 6px;
    font-weight: bold;
    font-size: 14px;
}

.rm-validation-feedback.success .icon {
    color: #1a7f37;
}

.rm-validation-feedback.warning .icon {
    color: #f57c00;
}

.rm-validation-feedback.error .icon {
    color: #cf222e;
}

/* Spinner Animation */
.rm-validation-feedback .spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 8px;
    border: 2px solid rgba(9, 105, 218, 0.3);
    border-top-color: #0969da;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

/* Fluent Form Field Borders on Validation */
.ff-el-form-control:focus + .rm-validation-feedback.success,
.ff-el-form-control.rm-validated-success {
    border-color: #acf2a8 !important;
}

.ff-el-form-control:focus + .rm-validation-feedback.error,
.ff-el-form-control.rm-validated-error {
    border-color: #f5c7c7 !important;
}

/* Password Strength Meter */
.rm-password-strength-meter {
    margin-top: 8px;
    height: 4px;
    background-color: #e1e4e8;
    border-radius: 2px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.rm-password-strength-bar {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.rm-password-strength-bar.weak {
    width: 33%;
    background-color: #cf222e;
}

.rm-password-strength-bar.medium {
    width: 66%;
    background-color: #f57c00;
}

.rm-password-strength-bar.strong {
    width: 100%;
    background-color: #1a7f37;
}

/* Requirements List */
.rm-password-requirements {
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    font-size: 12px;
}

.rm-password-requirements ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.rm-password-requirements li {
    padding: 3px 0;
    color: #666;
}

.rm-password-requirements li.met {
    color: #1a7f37;
}

.rm-password-requirements li.met:before {
    content: "✓ ";
    font-weight: bold;
}

.rm-password-requirements li.not-met:before {
    content: "○ ";
    color: #999;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .rm-validation-feedback {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .rm-validation-feedback .icon {
        font-size: 13px;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .rm-validation-feedback.checking {
        background-color: #1c2d41;
        border-color: #2d4263;
        color: #58a6ff;
    }
    
    .rm-validation-feedback.success {
        background-color: #1c3128;
        border-color: #2d5a3c;
        color: #56d364;
    }
    
    .rm-validation-feedback.warning {
        background-color: #3d2e00;
        border-color: #5c4600;
        color: #ffb84d;
    }
    
    .rm-validation-feedback.error {
        background-color: #3d1f1f;
        border-color: #5c2e2e;
        color: #ff7b72;
    }
    
    .rm-password-requirements {
        background-color: #161b22;
        border-color: #30363d;
    }
}

/* Fluent Forms Specific Adjustments */
.fluentform .ff-el-group {
    position: relative;
}

.fluentform .ff-el-form-control {
    transition: border-color 0.2s ease;
}

/* Success/Error Field Highlighting */
.fluentform .ff-el-group.rm-validated-success .ff-el-form-control {
    border-color: #acf2a8 !important;
    box-shadow: 0 0 0 0.2rem rgba(26, 127, 55, 0.15);
}

.fluentform .ff-el-group.rm-validated-error .ff-el-form-control {
    border-color: #f5c7c7 !important;
    box-shadow: 0 0 0 0.2rem rgba(207, 34, 46, 0.15);
}

/* Hide Default Fluent Forms Error Messages (Optional) */
.fluentform .ff-el-is-error.rm-has-realtime-validation .error {
    display: none;
}

/* Loading State for Submit Button */
.fluentform .ff_btn_submit[disabled].rm-validating {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

.fluentform .ff_btn_submit[disabled].rm-validating:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}