/* Custom Authentication Styles */

/* Loading overlays */
.auth-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Authentication cards */
.auth-card {
    max-width: 480px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: none;
    border-radius: 0.75rem;
}

.auth-card .card-header {
    border-radius: 0.75rem 0.75rem 0 0;
    padding: 1.5rem;
}

.auth-card .card-body {
    padding: 2rem;
    position: relative;
}

/* Password strength indicator */
#passwordStrength {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Ensure password strength message is always below password input group */
#passwordStrengthMessage {
    display: block !important;
    width: 100% !important;
    margin-top: 0.5rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-align: left !important;
    clear: both !important;
    float: none !important;
    position: static !important;
}

/* Force the password form to display in column layout */
.form-group-enhanced .d-flex.flex-column {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    align-items: stretch !important;
}

/* Prevent input-group from shrinking due to adjacent elements */
.form-group-enhanced .input-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 0 !important;
    flex-wrap: nowrap !important;
    margin-bottom: 0 !important;
}

/* Make sure eye icon appears after the input field, not below */
.form-group-enhanced .input-group .form-control,
.form-group-enhanced .input-group input {
    flex: 1 1 auto !important;
    margin-bottom: 0 !important;
    height: 48px !important;
    box-sizing: border-box !important;
    border-radius: 0.5rem 0 0 0.5rem !important;
    display: inline-block !important;
}

.form-group-enhanced .input-group .btn {
    flex: 0 0 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
    box-sizing: border-box !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    border-radius: 0 0.5rem 0.5rem 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.form-group-enhanced .input-group .btn i {
    margin: 0 auto !important;
    font-size: 1.25rem !important;
}

/* Ensure password input and username input have same width */
.form-group-enhanced .form-control-enhanced {
    width: 100%;
}

/* Loading button states */
.btn.loading {
    position: relative;
    color: transparent !important;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1060;
}

.toast {
    min-width: 300px;
}

.toast-header {
    background-color: transparent;
    border-bottom: none;
}

.toast-success {
    border-left: 4px solid #198754;
}

.toast-error {
    border-left: 4px solid #dc3545;
}

.toast-warning {
    border-left: 4px solid #ffc107;
}

.toast-info {
    border-left: 4px solid #0dcaf0;
}

/* Authentication navigation */
.auth-dropdown .dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
    padding: 0.5rem 0;
}

.auth-dropdown .dropdown-item {
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

.auth-dropdown .dropdown-item:hover {
    background-color: #f8f9fa;
    transform: translateX(2px);
}

.auth-dropdown .dropdown-header {
    font-weight: 600;
    color: #495057;
    padding: 0.5rem 1rem;
}

/* Force black text for language dropdown items in login form */
.dropdown-item-black,
.dropdown-item-black span {
    color: #212529 !important;
}

.language-switcher-black,
.language-switcher-black.btn,
.language-switcher-black.btn span,
.language-switcher-black span {
    color: #212529 !important;
}

/* Override inline styles for black text language switcher - more specific selectors */
.language-switcher-black span[style*="color"],
.language-switcher-black span[style*="#fff"],
.language-switcher-black span[style*="color: #fff"],
.language-switcher-black span[style*="color:#fff"],
.language-switcher-black span[style*="color: rgb(255, 255, 255)"],
.language-switcher-black span[style*="color:rgb(255, 255, 255)"] {
    color: #212529 !important;
}

/* Force all spans inside the black language switcher to be black */
.language-switcher-black * {
    color: #212529 !important;
}

/* Ensure the button itself has black text and proper styling */
.language-switcher-black.btn-outline-secondary {
    color: #212529 !important;
    border-color: #6c757d;
}

.language-switcher-black.btn-outline-secondary:hover {
    color: #fff !important;
    background-color: #6c757d;
    border-color: #6c757d;
}

.language-switcher-black.btn-outline-secondary:focus {
    color: #212529 !important;
    box-shadow: 0 0 0 0.25rem rgba(108, 117, 125, 0.25);
}

/* Nuclear option - force any element with inline white color to black when inside language switcher */
.language-switcher-black [style*="color: #fff"],
.language-switcher-black [style*="color:#fff"],
.language-switcher-black [style*="color: rgb(255, 255, 255)"],
.language-switcher-black [style*="color:rgb(255, 255, 255)"] {
    color: #212529 !important;
}

/* User avatar */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e9ecef;
}

/* Mobile responsiveness */
@media (max-width: 576px) {
    .auth-card {
        margin: 1rem;
        max-width: none;
    }

    .auth-card .card-body {
        padding: 1.5rem;
    }

    .toast-container {
        right: 0.5rem;
        left: 0.5rem;
        top: 0.5rem;
    }

    .toast {
        min-width: auto;
    }
}

/* Focus styles for better accessibility - enhanced forms only */
.btn:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-btn-focus-shadow-rgb), 0.5);
}

/* Animation for loading states */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.auth-loading-overlay {
    animation: fadeIn 0.3s ease-out;
}

/* Error states */
.form-error {
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.05);
}

/* ============================================
   ENHANCED FORM STYLING - Modern & Clean
   ============================================ */

/* Enhanced form group styling */
.form-group-enhanced {
    margin-bottom: 1.5rem;
    position: relative;
}

/* Enhanced form labels with icons */
.form-label-enhanced {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: #1f2937 !important;
    font-size: 0.95rem;
    position: relative;
    z-index: 2;
}

.form-label-enhanced i {
    color: #4b5563 !important;
    margin-right: 0.5rem;
    width: 1.2rem;
    text-align: center;
    font-size: 1rem;
}

/* Enhanced form controls - Modern clean style with soft light blue */
.form-control-enhanced {
    display: block;
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #1e293b !important;
    background-color: #f0f9ff !important;
    border: 2px solid #bae6fd !important;
    border-radius: 0.75rem;
    transition: all 0.2s ease-in-out;
    position: relative;
    z-index: 1;
}

/* Enhanced select controls - Matching style to form-control-enhanced */
.form-select-enhanced {
    display: block;
    width: 100%;
    padding: 0.875rem 1rem;
    padding-right: 2.5rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #1e293b !important;
    background-color: #f0f9ff !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: 2px solid #bae6fd !important;
    border-radius: 0.75rem;
    transition: all 0.2s ease-in-out;
    position: relative;
    z-index: 1;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Hover state - subtle enhancement */
.form-control-enhanced:hover {
    background-color: #e0f2fe !important;
    border-color: #7dd3fc !important;
}

/* Hover state for select - subtle enhancement */
.form-select-enhanced:hover {
    background-color: #e0f2fe !important;
    border-color: #7dd3fc !important;
}

/* Focus state - softer blue with reduced border thickness */
.form-control-enhanced:focus {
    background-color: #ffffff !important;
    border-color: #0ea5e9 !important;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
    outline: none;
    color: #0f172a !important;
}

/* Focus state for select - softer blue with reduced border thickness */
.form-select-enhanced:focus {
    background-color: #ffffff !important;
    border-color: #0ea5e9 !important;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
    outline: none;
    color: #0f172a !important;
}

/* Invalid state styling */
.form-control-enhanced.is-invalid {
    border-color: #f87171;
    background-color: #fef2f2;
}

/* Invalid state styling for select */
.form-select-enhanced.is-invalid {
    border-color: #f87171;
    background-color: #fef2f2;
}

.form-control-enhanced.is-invalid:focus {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

/* Input group styling for password field */
.form-group-enhanced .input-group {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
}

.form-group-enhanced .input-group .form-control-enhanced {
    border-radius: 0.75rem 0 0 0.75rem;
    border-right: none;
    height: auto;
    min-height: 54px;
}

.form-group-enhanced .input-group .btn {
    border-radius: 0 0.75rem 0.75rem 0;
    border: 2px solid #bae6fd;
    border-left: none;
    background-color: #f0f9ff;
    color: #0369a1;
    padding: 0.875rem 1rem;
    transition: all 0.2s ease-in-out;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-group-enhanced .input-group .btn:hover {
    background-color: #e0f2fe;
    border-color: #7dd3fc;
    color: #0c4a6e;
}

.form-group-enhanced .input-group .btn:focus {
    background-color: #ffffff;
    border-color: #0ea5e9;
    color: #0c4a6e;
    box-shadow: none;
    z-index: 3;
}

/* When password input is focused, sync the button border */
.form-group-enhanced .input-group .form-control-enhanced:focus+.btn {
    border-color: #0ea5e9;
    background-color: #ffffff;
}

/* Placeholder styling */
.form-control-enhanced::placeholder {
    color: #64748b;
    font-style: italic;
    font-weight: 400;
}

.form-control-enhanced:focus::placeholder {
    color: #94a3b8;
}

/* Override browser autocomplete styling that may cause dark backgrounds */
.form-control-enhanced:-webkit-autofill,
.form-control-enhanced:-webkit-autofill:hover,
.form-control-enhanced:-webkit-autofill:focus,
.form-control-enhanced:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #f0f9ff inset !important;
    -webkit-text-fill-color: #1e293b !important;
    background-color: #f0f9ff !important;
    border: 2px solid #bae6fd !important;
}

/* Override browser dark mode input styling */
.form-control-enhanced {
    color-scheme: light !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* Force override for input type specific styling */
input[type="text"].form-control-enhanced,
input[type="password"].form-control-enhanced,
input[type="email"].form-control-enhanced {
    background-color: #f0f9ff !important;
    color: #1e293b !important;
    border: 2px solid #bae6fd !important;
}

/* Ultimate override for any remaining black background issues */
.form-control-enhanced,
input.form-control-enhanced {
    background: #f0f9ff !important;
    background-color: #f0f9ff !important;
    color: #1e293b !important;
    border-color: #bae6fd !important;
}

/* Override any potential Bootstrap inheritance */
.card .form-control-enhanced,
.card-body .form-control-enhanced,
.auth-card .form-control-enhanced {
    background-color: #f0f9ff !important;
    color: #1e293b !important;
}

/* Field validation styling */
.field-validation {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #ef4444;
    font-weight: 500;
}

/* Required field indicator styling */
.form-label-enhanced .text-danger {
    color: #ef4444 !important;
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .form-control-enhanced {
        padding: 0.75rem 0.875rem;
        font-size: 0.95rem;
    }

    .form-group-enhanced .input-group .form-control-enhanced,
    .form-group-enhanced .input-group .btn {
        min-height: 48px;
        padding: 0.75rem 0.875rem;
    }

    .form-label-enhanced {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
}

/* Dark mode support (optional for future) */
@media (prefers-color-scheme: dark) {
    .form-control-enhanced {
        background-color: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }

    .form-control-enhanced:focus {
        background-color: #111827;
        border-color: #3b82f6;
        color: #ffffff;
    }

    .form-label-enhanced {
        color: #e5e7eb;
    }

    .form-label-enhanced i {
        color: #9ca3af;
    }
}