/**
 * Form Handler Styles
 * Smooth animations and transitions for the multi-step form
 */

/* Form step transitions */
.form-step {
    display: none;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.form-step.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

/* Error shake animation */
@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 ease-in-out;
}

/* Error message styling */
.form-error {
    display: none;
    color: #dc3545;
    font-size: 14px;
    margin-top: -10px;
    /* Pull up closer to input */
    margin-bottom: 15px;
    padding: 8px 12px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    animation: slideDown 0.3s ease;

    /* Center aligning to match inputs */
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 10;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Button loading state */
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Success message animation */
.success-message {
    animation: fadeInScale 0.5s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Input focus states */
.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

/* Input validation states */
.form-control.is-invalid {
    border-color: #dc3545;
}

.form-control.is-valid {
    border-color: #28a745;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Button hover effects */
.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
}

.btn-back:hover {
    background-color: #e9ecef;
    transition: all 0.3s ease;
}

/* Loading spinner for submit button */
.btn-primary.loading::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

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

/* Step loader fade effect */
.step-loader {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .form-error {
        font-size: 12px;
        padding: 6px 10px;
    }
}