/**
 * Menux Platform - Authentication CSS Styles
 *
 * This stylesheet contains all authentication-related styling including:
 * - AJAX form loading states
 * - Error and success message styling
 * - Form validation styling
 * - Loading animations and transitions
 *
 * @version 1.0.0
 * @author Menux Development Team
 */

/* ========================================
   AJAX Form Loading States
   ======================================== */

.form-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 8px;
    backdrop-filter: blur(2px);
    transition: all 0.3s ease;
}

.form-spinner {
    text-align: center;
    padding: 20px;
}

.form-spinner .spinner-border {
    width: 3rem;
    height: 3rem;
    color: #074942;
}

.loading-text {
    margin-top: 15px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.form-item {
    position: relative;
    overflow: hidden;
}

/* ========================================
   Error and Success Messages
   ======================================== */

.form-errors {
    margin-bottom: 1.5rem;
    border-radius: 8px;
    border: 1px solid #dc3545;
    background: #f8d7da;
    padding: 1rem;
    animation: slideInDown 0.3s ease;
}

.form-errors ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.form-errors li {
    margin-bottom: 5px;
    color: #721c24;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.form-errors li:before {
    content: "⚠️";
    margin-left: 8px;
    font-size: 12px;
}

.alert-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    animation: fadeInScale 0.3s ease-out;
}

.alert-success:before {
    content: "✅";
    margin-left: 8px;
    font-size: 14px;
}

.alert-danger {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    animation: fadeInScale 0.3s ease-out;
}

.alert-danger:before {
    content: "❌";
    margin-left: 8px;
    font-size: 14px;
}

.alert-info {
    background: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    animation: fadeInScale 0.3s ease-out;
}

.alert-info:before {
    content: "ℹ️";
    margin-left: 8px;
    font-size: 14px;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffeeba;
    color: #856404;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    animation: fadeInScale 0.3s ease-out;
}

.alert-warning:before {
    content: "⚠️";
    margin-left: 8px;
    font-size: 14px;
}

/* ========================================
   Form Validation Styling
   ======================================== */

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 5px;
    font-size: 12px;
    color: #dc3545;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s ease;
}

.invalid-feedback:not(:empty) {
    opacity: 1;
    transform: translateY(0);
}

.form-input.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    animation: shake 0.5s ease-in-out;
}

.form-input:focus.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Valid input styling */
.form-input.is-valid {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* ========================================
   Button States
   ======================================== */

.btn-spinner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.btn-spinner.show {
    opacity: 1;
    transform: scale(1);
}

.form-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.form-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: scale(0.98);
}

.form-btn:disabled:hover {
    transform: scale(0.98);
}

.btn-text {
    transition: all 0.3s ease;
}

.btn-text.hide {
    opacity: 0;
    transform: translateY(-10px);
}

/* ========================================
   Password Toggle Styling
   ======================================== */

.input-wrap {
    position: relative;
}

/* .pass-toggle {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    text-decoration: none;
    transition: all 0.3s ease;
    z-index: 10;
}

.pass-toggle:hover {
    color: #495057;
    transform: translateY(-50%) scale(1.1);
}

.pass-toggle svg {
    transition: all 0.3s ease;
} */

/* ========================================
   Animations
   ======================================== */

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

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

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

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

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

/* Loading Pulse Animation */
.form-loading-overlay .loading-text {
    animation: pulse 2s infinite;
}

/* Spinner Animation */
.spinner-border {
    animation: spin 1s linear infinite;
}

/* ========================================
   Toast Notifications
   ======================================== */



/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .form-loading-overlay {
        border-radius: 0;
    }

    .form-spinner {
        padding: 15px;
    }

    .form-spinner .spinner-border {
        width: 2.5rem;
        height: 2.5rem;
    }

    .loading-text {
        font-size: 13px;
    }


    .form-errors {
        margin-bottom: 1rem;
        padding: 0.75rem;
    }

    .alert-success {
        margin-bottom: 1rem;
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .form-spinner .spinner-border {
        width: 2rem;
        height: 2rem;
    }

    .loading-text {
        font-size: 12px;
        margin-top: 10px;
    }


}

/* ========================================
   Focus Management
   ======================================== */

.form-input:focus {
    outline: none;
    border-color: #074942;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    transition: all 0.3s ease;
}

/* ========================================
   Dark Mode Support (Optional)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .loading-text {
        color: #adb5bd;
    }

    .form-errors {
        background: rgba(220, 53, 69, 0.1);
        border-color: rgba(220, 53, 69, 0.3);
        color: #f5c6cb;
    }

    .alert-success {
        background: rgba(40, 167, 69, 0.1);
        border-color: rgba(40, 167, 69, 0.3);
        color: #d1f2d4;
    }
}

/* ========================================
   Accessibility Improvements
   ======================================== */

.form-loading-overlay[aria-hidden="true"] {
    display: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-input.is-invalid {
        border-width: 2px;
    }

    .form-errors {
        border-width: 2px;
    }

    .alert-success {
        border-width: 2px;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
