/**
 * Auth Validation Styles
 *
 * Styles for real-time form validation on login/register pages.
 * Works with auth-validation.js module.
 */

/* Input wrapper for validation icon positioning */
.form-group .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-group .input-wrapper input {
    flex: 1;
    padding-right: 40px; /* Space for validation icon */
}

/* Validation icon */
.validation-icon {
    position: absolute;
    right: 12px;
    width: 20px;
    height: 20px;
    display: none;
    pointer-events: none;
}

/* Validating spinner */
.form-group.is-validating .validation-icon {
    display: block;
}

.form-group.is-validating .validation-icon::before {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    border: 2px solid #E5E5E5;
    border-top-color: var(--primary-color, #7C3AED);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Valid state */
.form-group.is-valid .input-wrapper input {
    border-color: #10B981;
}

.form-group.is-valid .validation-icon {
    display: block;
}

.form-group.is-valid .validation-icon::before {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    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-size: contain;
    background-repeat: no-repeat;
}

/* Invalid state */
.form-group.is-invalid .input-wrapper input {
    border-color: #EF4444;
}

.form-group.is-invalid .validation-icon {
    display: block;
}

.form-group.is-invalid .validation-icon::before {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    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='M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

/* Field error message */
.field-error {
    color: #EF4444;
    font-size: 13px;
    margin-top: 6px;
    min-height: 18px;
}

.field-error:empty {
    display: none;
}

/* Password strength meter */
.password-strength {
    margin-top: 12px;
    display: none;
}

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

.strength-bar-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.strength-bar-fill.strength-weak {
    background: #EF4444;
    width: 25%;
}

.strength-bar-fill.strength-fair {
    background: #F59E0B;
    width: 50%;
}

.strength-bar-fill.strength-good {
    background: #10B981;
    width: 75%;
}

.strength-bar-fill.strength-strong {
    background: #10B981;
    width: 100%;
}

/* Strength text */
.strength-text {
    font-size: 12px;
    font-weight: 600;
    text-align: right;
}

.strength-text.strength-weak { color: #EF4444; }
.strength-text.strength-fair { color: #F59E0B; }
.strength-text.strength-good { color: #10B981; }
.strength-text.strength-strong { color: #10B981; }

/* Password requirements checklist */
.password-requirements {
    list-style: none;
    padding: 0;
    margin: 12px 0 0 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.password-requirements li {
    font-size: 12px;
    color: #64748B;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.password-requirements li.met {
    color: #10B981;
}

.password-requirements li.unmet {
    color: #94A3B8;
}

/* Requirement icon */
.password-requirements .req-icon {
    width: 14px;
    height: 14px;
    display: inline-block;
    flex-shrink: 0;
}

.password-requirements li.met .req-icon::before {
    content: '';
    display: block;
    width: 14px;
    height: 14px;
    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='M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-size: contain;
}

.password-requirements li.unmet .req-icon::before {
    content: '';
    display: block;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394A3B8'%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-size: contain;
}

/* Button loading state */
button.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

button.is-loading::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Focus styles for accessibility */
.form-group input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.form-group.is-valid input:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-group.is-invalid input:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Mobile responsive */
@media (max-width: 480px) {
    .password-requirements {
        grid-template-columns: 1fr;
    }
}
