/**
 * Enhanced Registration Form Validation Styles
 * Features: Smooth animations, validation states, mobile responsiveness
 */

/* ===== VALIDATION FIELD STATES ===== */
.border-valid {
    border-color: #38d97a !important;
    box-shadow: 0 0 0 2px rgba(56, 217, 122, 0.2) !important;
}

.border-invalid {
    border-color: #ff4d4f !important;
    box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2) !important;
}

/* ===== VALIDATION MESSAGES ===== */
.validation-error {
    display: none;
    margin-top: 6px;
    font-size: 0.82rem;
    color: #ff4d4f;
    line-height: 1.35;
    animation: slideDown 0.3s ease-out;
}

.validation-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.35;
}

.validation-success {
    display: none;
    margin-top: 6px;
    font-size: 0.82rem;
    color: #38d97a;
    line-height: 1.35;
    animation: slideDown 0.3s ease-out;
}

/* ===== OTP FIELD ANIMATIONS ===== */
.otp-group {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0;
    transform: translateY(-10px);
}

.otp-group.otp-active {
    max-height: 200px;
    opacity: 1;
    margin: 20px 0;
    transform: translateY(0);
}

/* ===== BUTTON STATES ===== */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::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: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* ===== SEND OTP BUTTON ===== */
#sendOtpBtn {
    min-width: 120px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#sendOtpBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.3);
}

#sendOtpBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#sendOtpBtn .fa-spinner {
    animation: spin 1s linear infinite;
}

/* ===== SUCCESS MESSAGE FOR OTP ===== */
.otp-success-message {
    background: rgba(56, 217, 122, 0.1);
    border: 1px solid rgba(56, 217, 122, 0.3);
    border-left: 4px solid #38d97a;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #38d97a;
    animation: slideDown 0.3s ease-out;
}

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

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

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ===== INPUT FOCUS ENHANCEMENTS ===== */
input:focus {
    outline: none;
    transition: all 0.3s ease;
}

input.border-valid:focus {
    border-color: #38d97a !important;
    box-shadow: 0 0 0 3px rgba(56, 217, 122, 0.3) !important;
}

input.border-invalid:focus {
    border-color: #ff4d4f !important;
    box-shadow: 0 0 0 3px rgba(255, 77, 79, 0.3) !important;
}

/* ===== PASSWORD TOGGLE ENHANCEMENTS ===== */
.toggle-password {
    transition: all 0.3s ease;
}

.toggle-password:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: scale(1.1);
}

.toggle-password.is-on {
    color: #38d97a !important;
}

/* ===== FORM FIELD ENHANCEMENTS ===== */
.field {
    position: relative;
    margin-bottom: 20px;
}

.field input {
    transition: all 0.3s ease;
}

.field input:focus {
    transform: translateY(-1px);
}

/* ===== ERROR BOX ENHANCEMENTS ===== */
.error-box {
    background: rgba(255, 77, 79, 0.1);
    border: 1px solid rgba(255, 77, 79, 0.3);
    border-left: 4px solid #ff4d4f;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    animation: shake 0.5s ease-in-out;
}

.error-box p {
    color: #ff4d4f;
    margin: 5px 0;
    font-size: 0.9rem;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .validation-error,
    .validation-success {
        font-size: 0.78rem;
    }
    
    .validation-hint {
        font-size: 0.74rem;
    }
    
    #sendOtpBtn {
        min-width: 100px;
        font-size: 0.85rem;
        padding: 10px 15px;
    }
    
    .otp-group.otp-active {
        max-height: 180px;
        margin: 15px 0;
    }
}

@media (max-width: 480px) {
    .validation-error,
    .validation-success {
        font-size: 0.75rem;
    }
    
    .validation-hint {
        font-size: 0.7rem;
    }
    
    #sendOtpBtn {
        min-width: 90px;
        font-size: 0.8rem;
        padding: 8px 12px;
    }
    
    .otp-group.otp-active {
        max-height: 160px;
        margin: 12px 0;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .otp-group,
    .validation-error,
    .validation-success,
    #sendOtpBtn,
    .toggle-password,
    input {
        transition: none;
        animation: none;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .validation-error {
        color: #ff0000;
        font-weight: bold;
    }
    
    .validation-success {
        color: #00ff00;
        font-weight: bold;
    }
    
    .border-valid {
        border-color: #00ff00 !important;
        border-width: 2px !important;
    }
    
    .border-invalid {
        border-color: #ff0000 !important;
        border-width: 2px !important;
    }
}

/* ===== DARK MODE ENHANCEMENTS ===== */
@media (prefers-color-scheme: dark) {
    .validation-error {
        color: #ff6b6b;
    }
    
    .validation-success {
        color: #51cf66;
    }
    
    .border-valid {
        border-color: #51cf66 !important;
        box-shadow: 0 0 0 2px rgba(81, 207, 102, 0.2) !important;
    }
    
    .border-invalid {
        border-color: #ff6b6b !important;
        box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2) !important;
    }
}
