/* Authentication System Styles */

.auth-message {
    margin: 10px 0;
    padding: 12px 15px;
    border-radius: 8px;
    font-weight: 500;
    background-color: #fff3cd !important;
    border: 1px solid #ffeaa7 !important;
    color: #856404 !important;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-message.alert-danger {
    background-color: #fff3cd !important;
    color: #856404 !important;
    border: 1px solid #ffeaa7 !important;
}

.auth-message.alert-success {
    background-color: #d4edda !important;
    color: #155724 !important;
    border: 1px solid #c3e6cb !important;
}

.auth-message .close-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #856404;
    padding: 0;
    margin-left: 10px;
}

.auth-message .close-btn:hover {
    color: #000;
}

.captcha-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.captcha-wrapper canvas {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
}

#refresh-captcha {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#refresh-captcha i {
    margin-right: 5px;
}

.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
}

.login-container, .register-container {
    background: transparent !important;
    border-radius: 15px;
    box-shadow: none !important;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    margin: 20px;
    border: none !important;
}

.login-form, .register-form {
    width: 100%;
    background: transparent !important;
}

.login-form .container, .register-form .container {
    background: transparent !important;
    padding: 0 !important;
}

/* Override any existing white backgrounds */
body.login-body * {
    background-color: transparent !important;
}

body.login-body .container,
body.login-body .login-container,
body.login-body .register-container,
body.login-body .login-form,
body.login-body .register-form {
    background: transparent !important;
    background-color: transparent !important;
}

/* Ensure form elements are visible on dark background */
.form-control {
    background-color: rgba(255, 255, 255, 0.9) !important;
    color: #333 !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-control:focus {
    background-color: white !important;
    color: #333 !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25) !important;
}

.form-control::placeholder {
    color: #666 !important;
}

.login-logo {
    margin-bottom: 30px;
}

.login-logo img {
    max-width: 200px;
    height: auto;
}

.form-control {
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 16px;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    background-color: white;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-outline-secondary {
    border: 2px solid #6c757d;
    color: #6c757d;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    color: white;
    transform: translateY(-1px);
}

.form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.login-links a, .text-center a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.login-links a:hover, .text-center a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.form-check-label {
    font-weight: 500;
    color: #495057;
}

/* Responsive Design */
@media (max-width: 576px) {
    .login-container, .register-container {
        margin: 10px;
        padding: 30px 20px;
    }
    
    .captcha-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    #refresh-captcha {
        width: 100%;
        margin-top: 10px;
    }
}

/* Animation for form elements */
.form-control, .btn-primary, .btn-outline-secondary {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state for buttons */
.btn-primary.loading {
    position: relative;
    color: transparent;
}

.btn-primary.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* User Avatar and Dropdown Styles */
.user-dropdown-desktop, .user-dropdown-mobile {
    position: relative;
}

.user-avatar-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.5rem 0.75rem !important;
    text-decoration: none !important;
    color: white !important;
    transition: all 0.3s ease !important;
}

.user-avatar-link:hover {
    color: #ff6b6b !important;
    text-decoration: none !important;
}

.avatar-icon {
    font-size: 24px !important;
    color: #667eea !important;
    transition: all 0.3s ease !important;
}

.user-avatar-link:hover .avatar-icon {
    color: #ff6b6b !important;
    transform: scale(1.1) !important;
}

/* Dropdown Menu Styles */
.user-dropdown-menu, .user-dropdown-menu-desktop {
    position: absolute;
    top: 100%;
    right: 0;
    background: #2d1b69;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 0;
    min-width: 200px;
    display: none;
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.user-dropdown-menu.show, .user-dropdown-menu-desktop.show {
    display: block;
}

.dropdown-header {
    padding: 15px 15px 10px 15px;
    background: #2d1b69;
}

.username-display, .username-display-desktop {
    color: white;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 5px;
    display: block;
}

.user-xp {
    color: #ff6b6b;
    font-size: 14px;
    font-weight: 500;
    display: block;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0;
}

.dropdown-item {
    color: white;
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dropdown-item.logout-item {
    color: #ff6b6b;
}

.dropdown-item.logout-item:hover {
    background: rgba(255, 107, 107, 0.1);
}

/* Mobile Dropdown Menu */
.user-dropdown-menu-mobile {
    position: absolute;
    top: 100%;
    right: 0;
    background: #2d1b69;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 0;
    min-width: 200px;
    display: none;
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.user-dropdown-menu-mobile.show {
    display: block;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .user-dropdown-menu-desktop {
        display: none !important;
    }
}

/* User Details Section - COMPLETELY HIDDEN */
.user-details-section {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* Override any existing white backgrounds */
.user-welcome-card * {
    background-color: transparent !important;
}

.user-welcome-card .container,
.user-welcome-card .row,
.user-welcome-card .col-md-8,
.user-welcome-card .col-md-4,
.user-welcome-card .user-info-content {
    background: transparent !important;
    background-color: transparent !important;
}

.welcome-text {
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.welcome-text i {
    color: #ff6b6b;
    margin-right: 10px;
}

.user-info-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-actions {
    margin-top: 15px;
    text-align: center;
}

.stat-label {
    font-size: 0.9rem;
    color: #b8b8b8;
    font-weight: 500;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.1rem;
    color: #ffffff;
    font-weight: 600;
}

.user-actions .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    background: transparent;
    border: 2px solid #ff6b6b;
    color: #ff6b6b;
}

.user-actions .btn:hover {
    background: #ff6b6b;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

/* Responsive design for user details */
@media (max-width: 768px) {
    .user-details-section .container-fluid {
        justify-content: center;
        padding-right: 0;
    }
    
    .user-welcome-card {
        max-width: 100%;
        margin: 0 20px;
    }
    
    .user-welcome-card {
        padding: 20px;
    }
    
    .welcome-text {
        font-size: 1.3rem;
    }
    
    .user-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .stat-item {
        min-width: auto;
    }
    
    .user-actions {
        margin-top: 20px;
        text-align: center;
    }
}

/* CRITICAL: Force dark theme for user details - highest priority */
#user-details-section .user-welcome-card {
    background: #2d1b69 !important;
    background-color: #2d1b69 !important;
    background-image: none !important;
}

#user-details-section .user-welcome-card * {
    background-color: transparent !important;
    background: transparent !important;
}

#user-details-section .user-welcome-card .container,
#user-details-section .user-welcome-card .row,
#user-details-section .user-welcome-card .col-md-8,
#user-details-section .user-welcome-card .col-md-4,
#user-details-section .user-welcome-card .user-info-content {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
}

/* Force text colors */
#user-details-section .welcome-text {
    color: #ffffff !important;
}

#user-details-section .stat-label {
    color: #b8b8b8 !important;
}

#user-details-section .stat-value {
    color: #ffffff !important;
}
