/* Universal Theme Modal - Works with all themes */

/* User Authentication Section */
.auth-section {
    max-width: 600px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.login-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.95));
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.login-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.5rem 0;
}

.login-header p {
    color: #6b7280;
    font-size: 0.95rem;
    margin: 0;
}

.login-form {
    display: flex;
    gap: 1rem;
    flex-direction: column;
    align-items: center;
}

.token-input-large {
    width: 100%;
    max-width: 400px;
    padding: 1rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: #374151;
    font-size: 1rem;
    transition: all 0.2s ease;
    text-align: center;
}

.token-input-large:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: rgba(255, 255, 255, 1);
}

.token-input-large::placeholder {
    color: #9ca3af;
    text-align: center;
}

.login-button {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.login-button:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.login-button:active {
    transform: translateY(0);
}

/* User Welcome Card */
.user-card {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(16, 185, 129, 0.1));
    border: 2px solid rgba(34, 197, 94, 0.3);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.1);
    backdrop-filter: blur(10px);
}

.user-welcome-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.user-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #059669;
    margin: 0 0 0.5rem 0;
}

.user-info p {
    color: #6b7280;
    font-size: 0.95rem;
    margin: 0;
}

.logout-button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.logout-button:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

/* Responsive Design */
@media (max-width: 640px) {
    .auth-section {
        padding: 0 0.5rem;
        margin: 1.5rem auto;
    }
    
    .login-card, .user-card {
        padding: 1.5rem;
    }
    
    .login-form {
        gap: 1rem;
    }
    
    .token-input-large {
        font-size: 0.95rem;
        padding: 0.875rem 1rem;
    }
    
    .login-button {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .user-welcome-header {
        flex-direction: column;
        text-align: center;
    }
    
    .logout-button {
        width: 100%;
        justify-content: center;
    }
}

/* User Stats Section - Base Layout Only (themes handle appearance) */
.user-stats-section {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    /* Theme-specific background, borders, and effects are handled by individual theme files */
}

.user-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.user-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.user-stat-box {
    /* Basic structure only - all appearance handled by themes */
    text-align: center;
    /* Theme-specific padding, background, borders, border-radius, and colors are handled by individual theme files */
}

.user-profile-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.user-welcome {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.user-type-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.logout-button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Login Section Below Banner */
.login-section-banner {
    max-width: 600px;
    margin: 1.5rem auto;
    padding: 0 1rem;
    text-align: center;
}

.login-modal-button-banner {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    backdrop-filter: blur(10px);
}

.login-modal-button-banner:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.login-modal-button-banner:active {
    transform: translateY(0);
}

/* Legacy Login Modal Button in Header (if needed) */
.login-modal-button {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.login-modal-button:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.login-modal-button:active {
    transform: translateY(0);
}

/* User Status Display */
.user-status-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-welcome-compact {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.8rem;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(16, 185, 129, 0.1));
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 6px;
    color: #059669;
    font-size: 0.85rem;
    font-weight: 600;
}

.logout-button-compact {
    padding: 0.4rem 0.6rem;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.logout-button-compact:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.4);
}

/* Authentication Modal */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: modalFadeIn 0.3s ease;
    visibility: visible;
    opacity: 1;
}

.auth-modal.auth-modal-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.auth-modal-content {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalSlideIn 0.3s ease;
    position: relative;
}

.auth-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.auth-modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-modal-body {
    text-align: center;
}

.auth-description {
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.token-input-modal {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #374151;
    font-size: 1rem;
    transition: all 0.2s ease;
    text-align: center;
    margin-bottom: 1rem;
}

.token-input-modal:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: rgba(255, 255, 255, 1);
}

.token-input-modal::placeholder {
    color: #9ca3af;
    text-align: center;
}

.login-button-modal {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.login-button-modal:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.login-button-modal:active {
    transform: translateY(0);
}

.auth-error {
    padding: 0.75rem;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #dc2626;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Mobile Responsiveness for Auth Modal */
@media (max-width: 768px) {
    .auth-modal-content {
        padding: 1.5rem;
        margin: 1rem;
        border-radius: 8px;
        max-width: none;
        width: calc(100% - 2rem);
    }
    
    .auth-modal-header h3 {
        font-size: 1.2rem;
    }
    
    .token-input-modal {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }
    
    .login-button-modal {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .login-modal-button {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .login-modal-button-banner {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
        width: 100%;
        justify-content: center;
    }
    
    .login-section-banner {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }
    
    .user-welcome-compact {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
    
    .analytics-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .coming-soon-features {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .analytics-card {
        padding: 0.75rem;
    }
    
    .personal-leaderboard,
    .coming-soon-section {
        padding: 0.75rem;
    }
    
    /* User stats mobile styles removed - handled by themes */
    
    .leaderboard-item {
        padding: 0.5rem;
    }
    
    .model-info {
        margin-left: 0.5rem;
    }
}

/* Hidden state - highest priority */
.theme-modal.theme-modal-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Visible state */
.theme-modal:not(.theme-modal-hidden) {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.8) !important;
    backdrop-filter: blur(10px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important;
    animation: modalFadeIn 0.3s ease !important;
    visibility: visible !important;
    opacity: 1 !important;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.theme-modal-content {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    padding: 2rem !important;
    max-width: 800px !important;
    width: 90% !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    animation: modalSlideIn 0.3s ease !important;
    position: relative !important;
}

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

.theme-modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 2rem !important;
    padding-bottom: 1rem !important;
    border-bottom: 1px solid #e5e7eb !important;
}

.theme-modal-header h3 {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    color: #111827 !important;
    margin: 0 !important;
}

.close-button {
    background: none !important;
    border: 1px solid #d1d5db !important;
    color: #6b7280 !important;
    font-size: 1.5rem !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    padding: 0.5rem !important;
    border-radius: 6px !important;
    width: 2.5rem !important;
    height: 2.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
}

.close-button:hover {
    background: #f3f4f6 !important;
    border-color: #9ca3af !important;
    color: #111827 !important;
}

.theme-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 1.5rem !important;
}

.theme-card {
    background: #f9fafb !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    padding: 1.5rem !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    position: relative !important;
}

.theme-card:hover {
    border-color: #6366f1 !important;
    background: #ffffff !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-1px) !important;
}

.theme-card.active {
    border-color: #6366f1 !important;
    background: rgba(99, 102, 241, 0.05) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
}

.theme-card.active::after {
    content: '✓' !important;
    position: absolute !important;
    top: 1rem !important;
    right: 1rem !important;
    background: #6366f1 !important;
    color: white !important;
    width: 1.5rem !important;
    height: 1.5rem !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
}

.theme-preview {
    font-size: 3rem !important;
    text-align: center !important;
    margin-bottom: 1rem !important;
    height: 4rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0.8 !important;
}

.theme-info h4 {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.5rem !important;
    color: #111827 !important;
    text-align: center !important;
}

.theme-info p {
    color: #6b7280 !important;
    font-size: 0.9rem !important;
    text-align: center !important;
    margin-bottom: 1rem !important;
    line-height: 1.4 !important;
}

.theme-category {
    display: inline-block !important;
    background: #f3f4f6 !important;
    color: #6b7280 !important;
    padding: 0.3rem 0.8rem !important;
    border-radius: 4px !important;
    font-size: 0.75rem !important;
    text-align: center !important;
    width: 100% !important;
    border: 1px solid #e5e7eb !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

/* Responsive theme modal */
@media (max-width: 768px) {
    .theme-modal-content {
        padding: 1.5rem !important;
        margin: 1rem !important;
        border-radius: 8px !important;
    }
    
    .theme-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .theme-card {
        padding: 1rem !important;
    }
}